1
- name : Build and deploy
1
+ name : Deploy
2
2
3
3
on :
4
4
push :
5
- branches : ' *'
6
5
tags : ' v[0-9]+.[0-9]+.[0-9]+*'
7
- pull_request :
8
- branches : ' *'
9
6
workflow_dispatch :
10
- inputs :
11
- deploy :
12
- type : boolean
13
- default : false
14
7
15
8
env :
16
9
NODE_VERSION : 18
17
10
REGISTRY : ghcr.io
18
11
IMAGE_NAME : object-object/discord-github-utils
19
12
20
13
jobs :
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
92
17
93
18
push-image :
94
19
needs :
95
- - setup-deployments
96
- - build-image
20
+ - build
97
21
runs-on : ubuntu-latest
98
22
permissions :
99
23
contents : read
100
24
packages : write
101
25
environment :
102
26
name : docker
103
- url : https://${{ needs.build-image .outputs.tag }}
27
+ url : https://${{ needs.build.outputs.image- tag }}
104
28
outputs :
105
29
digest : ${{ steps.digest.outputs.value }}
106
30
steps :
@@ -127,12 +51,11 @@ jobs:
127
51
128
52
- name : Get image digest
129
53
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"
131
55
132
56
deploy-aws-cdk :
133
57
needs :
134
- - setup-deployments
135
- - build-aws-cdk
58
+ - build
136
59
runs-on : ubuntu-latest
137
60
permissions :
138
61
contents : read
164
87
165
88
deploy-codedeploy :
166
89
needs :
167
- - setup-deployments
168
90
- push-image
169
91
- deploy-aws-cdk
170
92
runs-on : ubuntu-latest
0 commit comments