-
Notifications
You must be signed in to change notification settings - Fork 9
217 lines (191 loc) · 6.6 KB
/
manual-release.yml
File metadata and controls
217 lines (191 loc) · 6.6 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Manual Release
run-name: Production Release ${{ github.ref_name }} (pushed by ${{ github.actor }})
env:
IMAGE_NAME: ghcr.io/herodevs/eol-scan
on:
push:
tags:
- v*
permissions:
contents: read
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
- uses: ./.github/actions/verify-version
id: verify-version
- name: Verify tag matches version
run: |
VERSION=${{ steps.verify-version.outputs.version }}
TAG_VERSION=${GITHUB_REF#refs/tags/v}
if [ "$VERSION" != "$TAG_VERSION" ]; then
echo "Error: Package version ($VERSION) does not match tag version ($TAG_VERSION)"
exit 1
fi
- name: Determine Oclif channel
id: determine-oclif-channel
run: |
VERSION=${{ steps.verify-version.outputs.version }}
if [[ "$VERSION" == *"-beta"* ]]; then
echo "oclif_channel=beta" >> $GITHUB_OUTPUT
elif [[ "$VERSION" == *"-alpha"* ]]; then
echo "oclif_channel=alpha" >> $GITHUB_OUTPUT
elif [[ "$VERSION" == *"-next"* ]]; then
echo "oclif_channel=next" >> $GITHUB_OUTPUT
else
echo "oclif_channel=latest" >> $GITHUB_OUTPUT
fi
outputs:
version: ${{ steps.verify-version.outputs.version }}
oclif_channel: ${{ steps.determine-oclif-channel.outputs.oclif_channel }}
test:
runs-on: ubuntu-latest
needs: check-version
env:
GRAPHQL_HOST: ${{ secrets.GRAPHQL_HOST }}
EOL_REPORT_URL: ${{ secrets.EOL_REPORT_URL }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
- run: npm ci
- run: npm run build
- run: npm test
- run: npm run test:e2e
upload-assets:
runs-on: ubuntu-latest
needs: [check-version, test]
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
# Build
- run: npm ci
- run: npm run build
# Build platform-specific tarballs
- name: Install linux toolchain
run: |
sudo apt update
sudo apt install nsis p7zip-full p7zip-rar -y
- name: Build all tarballs in parallel
run: |
npx oclif pack tarballs --targets=linux-x64,win32-x64,darwin-arm64 --no-xz --parallel
# Create GitHub Release (draft - will be published manually from GitHub UI or CLI)
- name: Create GitHub Release
run: |
gh release create v${{ needs.check-version.outputs.version }} \
--title "Release v${{ needs.check-version.outputs.version }} ${{ needs.check-version.outputs.oclif_channel == 'latest' && 'Latest' || needs.check-version.outputs.oclif_channel }}" \
--generate-notes \
--draft \
--prerelease=${{ needs.check-version.outputs.oclif_channel != 'latest' }} \
dist/*.tar.gz
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# S3 Distribution
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ vars.aws_oidc_role_arn }}
role-session-name: herodevs_cli_upload
aws-region: ${{ vars.AWS_REGION }}
- name: Upload and promote to S3
run: |
# Enable oclif debug logging
export DEBUG=oclif:*
# Upload tarballs
npx oclif upload tarballs \
--targets=linux-x64,win32-x64,darwin-arm64 \
--no-xz
# Get shortened SHA (first 7 characters)
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
echo "Using shortened SHA: $SHORT_SHA"
# Promote to channel
npx oclif promote \
--channel=${{ needs.check-version.outputs.oclif_channel }} \
--version=${{ needs.check-version.outputs.version }} \
--sha=$SHORT_SHA \
--indexes \
--targets=linux-x64,win32-x64,darwin-arm64 \
--ignore-missing
npm-publish:
runs-on: ubuntu-latest
needs: [check-version, test, upload-assets]
permissions:
id-token: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
# Clean build for npm publishing
- run: npm ci
- run: npm run build
# Dry run NPM publish
- name: Dry run NPM publish
run: npm publish --tag ${{ needs.check-version.outputs.oclif_channel }} --provenance --access public --dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.HD_CLI_NPM_TOKEN }}
# NPM Release
- name: Create NPM release
run: npm publish --tag ${{ needs.check-version.outputs.oclif_channel }} --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.HD_CLI_NPM_TOKEN }}
publish-images:
name: Publish Images
needs: [npm-publish]
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v6
- uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
large-packages: true
haskell: false
docker-images: false
swap-storage: false
- name: Set up Node
uses: actions/setup-node@v6.1.0
with:
node-version-file: '.nvmrc'
- name: Parse tag
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- uses: docker/metadata-action@v5
id: meta
with:
images: |
name=${{ env.IMAGE_NAME }}
tags: |
type=sha,format=long
type=raw,value=latest
type=raw,value=${{ env.VERSION }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
context: .
file: ./ci/image.Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ needs.check-version.outputs.version }}