Skip to content

Commit

Permalink
test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
baksetercx committed May 6, 2024
1 parent d2bbfb3 commit 22b2cf9
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
name: 'Deploy'

on:
pull_request:
push:
branches: ['workshop/*']

jobs:
set_name:
name: 'Get name from branch name and set env'
set-name:
name: 'Get name from branch name and set output'
outputs:
my_name: ${{ steps.set-name.outputs.my_name }}
runs-on: ubuntu-latest
steps:
- run: echo "MY_NAME=${BRANCH##*/}" >> "$GITHUB_ENV"
- name: 'Set name'
id: set-name
run: echo "my_name=${BRANCH##*/}" >> "$GITHUB_OUTPUT"
env:
BRANCH: ${{ github.ref_name }}

run_tests:
run-tests:
name: 'Run frontend tests'
runs-on: ubuntu-latest
defaults:
Expand Down Expand Up @@ -44,9 +48,9 @@ jobs:
build:
name: 'Build Docker image and push to registry'
# Task A.2:
# needs: [set_name]
# needs: [set-name]
# Answer A.2:
needs: [set_name, run_tests]
needs: [set-name, run-tests]
#
runs-on: ubuntu-latest
steps:
Expand All @@ -60,7 +64,7 @@ jobs:
uses: docker/build-push-action@v5
with:
push: 'true'
tags: 'ghcr.io/${{ github.repository }}/${{ env.MY_NAME }}:latest'
tags: 'ghcr.io/${{ github.repository }}/${{ needs.set-name.outputs.my_name }}:latest'
file: 'frontend/Dockerfile'

deploy:
Expand All @@ -69,7 +73,7 @@ jobs:
needs: [build]
env:
TF_VAR_revision_suffix: ${{ github.sha }}
TF_VAR_my_name: ${{ env.MY_NAME }}
TF_VAR_my_name: ${{ needs.set-name.outputs.my_name }}
ARM_CLIENT_ID: ${{ vars.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ vars.ARM_SUBSCRIPTION_ID }}
Expand Down

0 comments on commit 22b2cf9

Please sign in to comment.