1- name : Build and deploy
1+ name : Deploy
22
33on :
44 push :
5- branches : ' *'
65 tags : ' v[0-9]+.[0-9]+.[0-9]+*'
7- pull_request :
8- branches : ' *'
96 workflow_dispatch :
10- inputs :
11- deploy :
12- type : boolean
13- default : false
147
158env :
169 NODE_VERSION : 18
1710 REGISTRY : ghcr.io
1811 IMAGE_NAME : object-object/discord-github-utils
1912
2013jobs :
21- build-image :
22- runs-on : ubuntu-latest
23- outputs :
24- tag : ${{ fromJson(steps.meta.outputs.json).tags[0] }}
25- steps :
26- - uses : actions/checkout@v4
27- - uses : docker/setup-buildx-action@v3
28-
29- - name : Login to GitHub Container Registry
30- uses : docker/login-action@v3
31- with :
32- registry : ${{ env.REGISTRY }}
33- username : ${{ github.actor }}
34- password : ${{ secrets.GITHUB_TOKEN }}
35-
36- - name : Extract image metadata
37- id : meta
38- uses : docker/metadata-action@v5
39- with :
40- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41-
42- - name : Build Docker image
43- id : build
44- uses : docker/build-push-action@v5
45- with :
46- context : .
47- tags : ${{ steps.meta.outputs.tags }}
48- labels : ${{ steps.meta.outputs.labels }}
49- outputs : type=docker,dest=/tmp/image.tar
50-
51- - name : Upload image artifact
52- uses : actions/upload-artifact@v4
53- with :
54- name : docker-image
55- path : /tmp/image.tar
56- retention-days : 7
57-
58- build-aws-cdk :
59- runs-on : ubuntu-latest
60- steps :
61- - uses : actions/checkout@v4
62- - uses : eifinger/setup-rye@v4
63- with :
64- enable-cache : true
65- github-token : ${{ secrets.GITHUB_TOKEN }}
66- - uses : object-Object/ci/setup@v0
67- with :
68- node-version : ${{ env.NODE_VERSION }}
69- npm-packages : aws-cdk
70-
71- - name : Sync dependencies
72- run : rye sync --no-lock --no-dev
73-
74- - name : Synth aws-cdk stack
75- run : cdk synth --ci --no-lookups --strict
76-
77- - name : Upload synth artifact
78- uses : actions/upload-artifact@v4
79- with :
80- name : aws-cdk-synth
81- path : cdk.out
82-
83- # dummy "gate" job to restrict when the deployment jobs can run
84- setup-deployments :
85- needs :
86- - build-image
87- - build-aws-cdk
88- if : github.event_name == 'push' && contains(github.ref, 'refs/tags/') || inputs.deploy
89- runs-on : ubuntu-latest
90- steps :
91- - run : echo
14+ build :
15+ uses : ./.github/workflows/build.yml
16+ secrets : inherit
9217
9318 push-image :
9419 needs :
95- - setup-deployments
96- - build-image
20+ - build
9721 runs-on : ubuntu-latest
9822 permissions :
9923 contents : read
10024 packages : write
10125 environment :
10226 name : docker
103- url : https://${{ needs.build-image .outputs.tag }}
27+ url : https://${{ needs.build.outputs.image- tag }}
10428 outputs :
10529 digest : ${{ steps.digest.outputs.value }}
10630 steps :
@@ -127,12 +51,11 @@ jobs:
12751
12852 - name : Get image digest
12953 id : digest
130- run : echo "value=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ needs.build-image .outputs.tag }})" >> "$GITHUB_OUTPUT"
54+ run : echo "value=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ needs.build.outputs.image- tag }})" >> "$GITHUB_OUTPUT"
13155
13256 deploy-aws-cdk :
13357 needs :
134- - setup-deployments
135- - build-aws-cdk
58+ - build
13659 runs-on : ubuntu-latest
13760 permissions :
13861 contents : read
16487
16588 deploy-codedeploy :
16689 needs :
167- - setup-deployments
16890 - push-image
16991 - deploy-aws-cdk
17092 runs-on : ubuntu-latest
0 commit comments