|
1 | 1 | import { exec } from 'child_process';
|
2 | 2 | import { awscdk, Component, github } from 'projen';
|
| 3 | +import { JobPermission } from 'projen/lib/github/workflows-model'; |
3 | 4 | import { NodeProject, TrailingComma, UpgradeDependenciesSchedule } from 'projen/lib/javascript';
|
4 | 5 | import { ReleaseTrigger } from 'projen/lib/release';
|
5 | 6 |
|
@@ -158,6 +159,44 @@ project.addTask('upgrade:ci:py', {
|
158 | 159 | },
|
159 | 160 | ],
|
160 | 161 | });
|
| 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 | +}) |
161 | 200 | project.eslint?.addRules({
|
162 | 201 | 'prettier/prettier': ['error', { singleQuote: true, printWidth: 140, trailingComma: TrailingComma.ALL }],
|
163 | 202 | });
|
|
0 commit comments