-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (108 loc) · 4.21 KB
/
Copy pathdeploy-bundle.yml
File metadata and controls
121 lines (108 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: 'Deploy Bundle'
'on':
'workflow_call':
'inputs':
'deploy-dir':
'description': 'Path to the caller-owned deploy directory.'
'required': false
'type': 'string'
'default': 'deploy'
'images':
'description': 'Newline- or comma-separated image refs to include in the bundle manifest.'
'required': false
'type': 'string'
'default': ''
'package-version':
'description': 'Version range for @jorisjonkers-dev/deploy-config-schema.'
'required': false
'type': 'string'
'default': '^0.6.0'
'version':
'description': 'Bundle version. Defaults to the ref name or a sha-prefixed development version.'
'required': false
'type': 'string'
'default': ''
'bundle-name':
'description': 'Bundle package basename. Defaults to the repository name.'
'required': false
'type': 'string'
'default': ''
'publish':
'description': 'Publish the packed deploy bundle to GHCR.'
'required': false
'type': 'boolean'
'default': false
'secrets':
'packages-token':
'description': 'Token used for GitHub Packages reads and GHCR writes.'
'required': false
'outputs':
'bundle-ref':
'description': 'Published or publishable OCI bundle ref.'
'value': '${{ jobs.deploy-bundle.outputs.bundle-ref }}'
'bundle-path':
'description': 'Packed bundle tarball path.'
'value': '${{ jobs.deploy-bundle.outputs.bundle-path }}'
'permissions':
'contents': 'read'
'packages': 'write'
'jobs':
'deploy-bundle':
'name': 'Deploy Bundle'
'runs-on': 'ubuntu-latest'
'outputs':
'bundle-ref': '${{ steps.bundle-ref.outputs.bundle-ref }}'
'bundle-path': '${{ steps.bundle.outputs.bundle-path }}'
'steps':
- 'uses': 'actions/checkout@v7'
- 'uses': 'actions/checkout@v7'
'with':
'repository': 'JorisJonkers-dev/github-workflows'
'ref': '${{ github.job_workflow_sha }}'
'path': '.github-workflows'
'persist-credentials': false
- 'name': 'Pack deploy bundle'
'id': 'bundle'
'uses': './.github-workflows/actions/deploy-bundle'
'with':
'deploy-dir': '${{ inputs.deploy-dir }}'
'images': '${{ inputs.images }}'
'package-version': '${{ inputs.package-version }}'
'version': '${{ inputs.version }}'
'bundle-name': '${{ inputs.bundle-name }}'
'node-auth-token': '${{ secrets.packages-token || github.token }}'
- 'name': 'Resolve bundle ref'
'id': 'bundle-ref'
'env':
'BUNDLE_NAME': '${{ steps.bundle.outputs.bundle-name }}'
'BUNDLE_VERSION': '${{ steps.bundle.outputs.bundle-version }}'
'GITHUB_REPOSITORY_OWNER': '${{ github.repository_owner }}'
'run': |
set -euo pipefail
owner="$(printf '%s' "$GITHUB_REPOSITORY_OWNER" | tr '[:upper:]' '[:lower:]')"
name="$(printf '%s' "$BUNDLE_NAME" | tr '[:upper:]' '[:lower:]')"
printf 'bundle-ref=ghcr.io/%s/%s-deploy-bundle:%s\n' "$owner" "$name" "$BUNDLE_VERSION" >> "$GITHUB_OUTPUT"
- 'name': 'Upload deploy bundle artifact'
'uses': 'actions/upload-artifact@v5'
'with':
'name': 'deploy-bundle'
'path': '${{ steps.bundle.outputs.bundle-path }}'
'if-no-files-found': 'error'
'retention-days': 7
- 'uses': 'oras-project/setup-oras@v2'
'if': '${{ inputs.publish }}'
- 'name': 'Log in to GHCR'
'if': '${{ inputs.publish }}'
'env':
'GHCR_TOKEN': '${{ secrets.packages-token || github.token }}'
'run': |
set -euo pipefail
oras login ghcr.io --username "$GITHUB_ACTOR" --password-stdin <<< "$GHCR_TOKEN"
- 'name': 'Publish deploy bundle'
'if': '${{ inputs.publish }}'
'env':
'BUNDLE_PATH': '${{ steps.bundle.outputs.bundle-path }}'
'BUNDLE_REF': '${{ steps.bundle-ref.outputs.bundle-ref }}'
'run': |
set -euo pipefail
oras push --disable-path-validation "$BUNDLE_REF" "$BUNDLE_PATH:application/vnd.jorisjonkers.deployment.bundle.v1+tar"