Skip to content

Commit b3e850b

Browse files
author
bweigel
committed
chore: add release workflow
1 parent e5b72e0 commit b3e850b

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projenrc.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { exec } from 'child_process';
22
import { awscdk, Component, github } from 'projen';
3+
import { JobPermission } from 'projen/lib/github/workflows-model';
34
import { NodeProject, TrailingComma, UpgradeDependenciesSchedule } from 'projen/lib/javascript';
45
import { ReleaseTrigger } from 'projen/lib/release';
56

@@ -158,6 +159,44 @@ project.addTask('upgrade:ci:py', {
158159
},
159160
],
160161
});
162+
project.release?.addJobs({
163+
'upload release artifact': {
164+
runsOn: ['ubuntu-latest'],
165+
permissions: { contents: JobPermission.WRITE },
166+
needs: ['release', 'release_github'],
167+
if: 'needs.release.outputs.latest_commit == github.sha',
168+
steps: [
169+
{
170+
uses: 'actions/setup-node@v3',
171+
with: {
172+
'node-version': '14.x'
173+
}
174+
},
175+
{
176+
name: 'Download build artifacts',
177+
uses: 'actions/download-artifact@v3',
178+
with: {
179+
name: 'build-artifact',
180+
path: 'dist'
181+
}
182+
},
183+
{
184+
name: 'Restore build artifact permissions',
185+
run: 'cd dist && setfacl --restore=permissions-backup.acl',
186+
continueOnError: true
187+
},
188+
{
189+
name: 'Upload Release Artifacts',
190+
env: {
191+
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}',
192+
GITHUB_REPOSITORY: '${{ github.repository }}',
193+
GITHUB_REF: '${{ github.ref }}',
194+
},
195+
run: 'errout=$(mktemp); gh release upload $(cat dist/releasetag.txt) --clobber -R $GITHUB_REPOSITORY dist/tesseract-al2-x86.zip 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi'
196+
}
197+
]
198+
}
199+
})
161200
project.eslint?.addRules({
162201
'prettier/prettier': ['error', { singleQuote: true, printWidth: 140, trailingComma: TrailingComma.ALL }],
163202
});

0 commit comments

Comments
 (0)