Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Skip azure steps if we are not to push docker images #9

Skip azure steps if we are not to push docker images

Skip azure steps if we are not to push docker images #9

Workflow file for this run

name: Build
on:
push:
branches:
- main
tags:
- '*'
paths-ignore:
- README.md
- LICENSE
- CHANGELOG.md
- docs/**
- '**/README.md'
pull_request:
branches:
- main
paths-ignore:
- README.md
- LICENSE
- CHANGELOG.md
- docs/**
- '**/README.md'
schedule:
- cron: '0 10 */15 * *'
workflow_dispatch:
env:
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
FALU_API_SECRET_KEY: ${{ secrets.FALU_API_SECRET_KEY }}
ACR_LOGIN_SERVER: ${{ secrets.ACR_LOGIN_SERVER }}
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0
id: gitversion
with:
useConfigFile: true
- name: Replace tokens in deploy folder
uses: cschleiden/replace-tokens@v1
with:
files: '["${{ github.workspace }}/deploy/**/*.bicep","${{ github.workspace }}/deploy/**/*.parameters.json"]'
env:
DOCKER_IMAGE_TAG: ${{ steps.gitversion.outputs.nuGetVersionV2 }}
- name: Publish deploy artifact
uses: actions/upload-artifact@v2
with:
path: deploy
name: deploy
retention-days: 1
- name: Build docker images
run: >
docker compose
--file ${{ github.workspace }}/docker-compose.yml
--file ${{ github.workspace }}/docker-compose.ci.yml
build
--parallel
env:
DOCKER_IMAGE_TAG: ${{ steps.gitversion.outputs.nuGetVersionV2 }}
- name: Azure Login
if: ${{ !contains(github.ref, 'dependabot/') && ((github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags')) }}
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 'Docker Login'
if: ${{ !contains(github.ref, 'dependabot/') && ((github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags')) }}
uses: azure/docker-login@v1
with:
login-server: ${{ env.ACR_LOGIN_SERVER }}
username: ${{ secrets.AZURE_SP_CLIENT_ID }}
password: ${{ secrets.AZURE_SP_CLIENT_SECRET }}
- name: Push docker images
if: ${{ !contains(github.ref, 'dependabot/') && ((github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags')) }}
run: >
docker compose
--file ${{ github.workspace }}/docker-compose.yml
--file ${{ github.workspace }}/docker-compose.ci.yml
push
env:
DOCKER_IMAGE_TAG: ${{ steps.gitversion.outputs.nuGetVersionV2 }}
- name: Deploy
if: ${{ !contains(github.ref, 'dependabot/') && ((github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags')) }}
uses: azure/arm-deploy@v1
with:
subscriptionId: ${{ env.AZURE_SUBSCRIPTION_ID }}
resourceGroupName: 'FALU-SAMPLES'
template: '${{ github.workspace }}/deploy/main.bicep'
parameters: '${{ github.workspace }}/deploy/main.parameters.json'
scope: 'resourcegroup'