|
1 | 1 | name: Release Please |
2 | 2 |
|
3 | | -# TODO: revert branches and paths |
4 | 3 | on: |
5 | 4 | push: |
6 | | - # branches: ['main', 'master'] |
7 | | - # paths: |
8 | | - # - 'get_cert.py' |
9 | | - # - 'get_cert.spec' |
10 | | - # - 'requirements.txt' |
11 | | - # - '*.md' |
| 5 | + branches: ['main', 'master'] |
12 | 6 | pull_request: |
13 | 7 | branches: ['main', 'master'] |
14 | | - paths: |
15 | | - - 'get_cert.py' |
16 | | - - 'get_cert.spec' |
17 | | - - 'requirements.txt' |
18 | | - - '*.md' |
19 | 8 |
|
20 | 9 | permissions: |
21 | 10 | contents: write |
|
32 | 21 | token: ${{ secrets.RELEASE_PLEASE_TOKEN }} |
33 | 22 | config-file: release-please-config.json |
34 | 23 | manifest-file: .release-please-manifest.json |
35 | | - |
36 | | - - uses: actions/checkout@v4 |
37 | | - if: ${{ steps.release.outputs.releases_created }} |
38 | | - |
39 | | - - name: Download and upload artifacts |
40 | | - if: ${{ steps.release.outputs.releases_created }} |
41 | | - env: |
42 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
43 | | - run: | |
44 | | - if [ -z "${{ steps.release.outputs.tag_name }}" ]; then |
45 | | - echo "No tag name provided. Skipping artifact upload." |
46 | | - exit 0 |
47 | | - fi |
48 | | -
|
49 | | - # Get the latest successful build artifacts |
50 | | - run_id=$(gh run list --workflow=build.yml --branch main --status completed --limit 1 --json databaseId --jq '.[0].databaseId') |
51 | | - if [ -z "$run_id" ]; then |
52 | | - echo "No successful build found. Skipping artifact upload." |
53 | | - exit 0 |
54 | | - fi |
55 | | - gh run download $run_id |
56 | | -
|
57 | | - # Get existing release assets |
58 | | - existing_assets=$(gh release view "${{ steps.release.outputs.tag_name }}" --json assets --jq '.assets[].name' || echo "") |
59 | | -
|
60 | | - # Upload new artifacts |
61 | | - uploaded=false |
62 | | - for file in */*.zip; do |
63 | | - if [ -f "$file" ]; then |
64 | | - filename=$(basename "$file") |
65 | | - if ! echo "$existing_assets" | grep -q "$filename"; then |
66 | | - gh release upload "${{ steps.release.outputs.tag_name }}" "$file" --clobber |
67 | | - echo "Uploaded $filename to release" |
68 | | - uploaded=true |
69 | | - fi |
70 | | - fi |
71 | | - done |
72 | | -
|
73 | | - $uploaded || echo "No new artifacts were uploaded to the release." |
0 commit comments