11name : Build
22
33on :
4- workflow_run :
5- workflows : ["Lint & Test"]
6- branches :
7- - main
8- types :
9- - completed
10-
11- concurrency :
12- group : ${{ github.workflow }}-${{ github.ref }}
13- cancel-in-progress : true
4+ workflow_call :
5+ inputs :
6+ sha-tag :
7+ description : " A short-form SHA tag for the commit that triggered this flow"
8+ required : true
9+ type : string
1410
1511jobs :
1612 build :
17- if : github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push'
1813 name : Build & Push
1914 runs-on : ubuntu-latest
2015
2116 steps :
22- # Create a commit SHA-based tag for the container repositories
23- - name : Create SHA Container Tag
24- id : sha_tag
25- run : |
26- tag=$(cut -c 1-7 <<< $GITHUB_SHA)
27- echo "::set-output name=tag::$tag"
2817 - name : Checkout code
2918 uses : actions/checkout@v3
30-
3119 # The current version (v2) of Docker's build-push action uses
3220 # buildx, which comes with BuildKit features that help us speed
3321 # up our builds using additional cache features. Buildx also
3422 # has a lot of other features that are not as relevant to us.
3523 #
3624 # See https://github.com/docker/build-push-action
3725 - name : Set up Docker Buildx
38- uses : docker/setup-buildx-action@v1
26+ uses : docker/setup-buildx-action@v2
3927
4028 - name : Login to Github Container Registry
41- uses : docker/login-action@v1
29+ uses : docker/login-action@v2
4230 with :
4331 registry : ghcr.io
4432 username : ${{ github.repository_owner }}
4836 # Repository. The container will be tagged as "latest"
4937 # and with the short SHA of the commit.
5038 - name : Build and push
51- uses : docker/build-push-action@v2
39+ uses : docker/build-push-action@v3
5240 with :
5341 context : .
5442 file : ./Dockerfile
5745 cache-to : type=inline
5846 tags : |
5947 ghcr.io/python-discord/code-jam-management:latest
60- ghcr.io/python-discord/code-jam-management:${{ steps.sha_tag.outputs. tag }}
48+ ghcr.io/python-discord/code-jam-management:${{ inputs.sha- tag }}
6149 build-args : |
6250 git_sha=${{ github.sha }}
6351
6755 runs-on : ubuntu-latest
6856
6957 steps :
70- # Create a commit SHA-based tag for the container repositories
71- - name : Create SHA Container Tag
72- id : sha_tag
73- run : |
74- tag=$(cut -c 1-7 <<< $GITHUB_SHA)
75- echo "::set-output name=tag::$tag"
7658
7759 # Check out the private "kubernetes" repository in the `kubernetes`
7860 # subdirectory using a GitHub Personal Access Token
@@ -82,16 +64,17 @@ jobs:
8264 repository : python-discord/kubernetes
8365 path : kubernetes
8466
67+ - uses : azure/setup-kubectl@v3
68+
8569 - name : Authenticate with Kubernetes
86- uses : azure/k8s-set-context@v1
70+ uses : azure/k8s-set-context@v3
8771 with :
8872 method : kubeconfig
8973 kubeconfig : ${{ secrets.KUBECONFIG }}
9074
9175 - name : Deploy to Kubernetes
92- uses : Azure/k8s-deploy@v1
76+ uses : Azure/k8s-deploy@v4
9377 with :
9478 manifests : |
9579 kubernetes/namespaces/default/code-jam-management/deployment.yaml
96- images : ' ghcr.io/python-discord/code-jam-management:${{ steps.sha_tag.outputs.tag }}'
97- kubectl-version : ' latest'
80+ images : ' ghcr.io/python-discord/code-jam-management:${{ inputs.sha-tag }}'
0 commit comments