Merge pull request #50 from equinor/snyk-fix-3452b4dbd788c12b93b78b2e… #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: radix-velero-plugin-build | |
on: | |
push: | |
branches: | |
- master | |
- release | |
permissions: | |
id-token: write | |
jobs: | |
build-and-test: | |
name: Build & test | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
id: go | |
- name: Build | |
run: make local | |
- name: Test | |
run: make test | |
get-target-configs: | |
name: Get target configs for branch | |
needs: | |
- build-and-test | |
outputs: | |
target_configs: ${{ steps.get-target-configs.outputs.target_configs }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get target configs | |
id: get-target-configs | |
run: | | |
configs=$(ls $GITHUB_WORKSPACE/.github/workflows/config/${GITHUB_REF_NAME} | jq -Rsc '. / "\n" - [""]') | |
echo "target_configs=${configs}" >> $GITHUB_OUTPUT | |
build-push-acr: | |
name: Build & push | |
runs-on: ubuntu-20.04 | |
needs: | |
- get-target-configs | |
strategy: | |
fail-fast: false | |
matrix: | |
config: ${{ fromJson(needs.get-target-configs.outputs.target_configs) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Persist environment from ${{ matrix.config }} across steps | |
run: | | |
env_vars_from_cfg=`env -i GITHUB_WORKSPACE=$GITHUB_WORKSPACE /bin/bash -c "set -a && source $GITHUB_WORKSPACE/.github/workflows/config/${GITHUB_REF_NAME}/${{ matrix.config }} && printenv"` | |
for env_var in $env_vars_from_cfg | |
do | |
echo $env_var >> $GITHUB_ENV | |
done | |
- uses: azure/login@v1 | |
with: | |
client-id: ${{ env.AZURE_CLIENT_ID }} | |
tenant-id: ${{ env.AZURE_TENANT_ID }} | |
subscription-id: ${{ env.AZURE_SUBSCRIPTION_ID }} | |
- name: Build image | |
run: | | |
$GITHUB_WORKSPACE/.github/workflows/scripts/build-push.sh |