|
1 | | -name: Upload Release Artifacts |
| 1 | +name: Attach archives to release |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - tags: |
6 | | - - 'v*' |
7 | 4 | release: |
8 | | - types: [created, published] |
| 5 | + types: [published] |
9 | 6 | workflow_dispatch: |
| 7 | + inputs: |
| 8 | + tag: |
| 9 | + description: Tag to use (e.g., v0.1.0 or 0.1.0) |
| 10 | + required: false |
| 11 | + |
| 12 | +permissions: |
| 13 | + actions: read |
| 14 | + contents: write |
10 | 15 |
|
11 | 16 | jobs: |
12 | | - release: |
| 17 | + attach-assets: |
13 | 18 | runs-on: ubuntu-latest |
14 | | - |
15 | 19 | steps: |
16 | | - - name: Checkout code |
17 | | - uses: actions/checkout@v4 |
| 20 | + - name: Checkout (not strictly required) |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + fetch-depth: 1 |
| 24 | + |
| 25 | + - name: Determine version from tag |
| 26 | + id: version |
| 27 | + shell: bash |
| 28 | + run: | |
| 29 | + set -euo pipefail |
| 30 | + tag="${{ github.event.release.tag_name || github.event.inputs.tag || github.ref_name }}" |
| 31 | + tag="${tag##refs/tags/}" |
| 32 | + ver="${tag#v}" # strip optional leading 'v' |
| 33 | + echo "tag=$tag" >> "$GITHUB_OUTPUT" |
| 34 | + echo "version=$ver" >> "$GITHUB_OUTPUT" |
| 35 | + echo "Using version: $ver" |
| 36 | +
|
| 37 | + - name: Download archives artifact from CI |
| 38 | + uses: dawidd6/action-download-artifact@v6 |
| 39 | + with: |
| 40 | + # Must match the artifact name used in the build workflow |
| 41 | + name: model-archives-${{ steps.version.outputs.version }} |
| 42 | + # Point to the workflow file that produced the artifact |
| 43 | + workflow: build-artifacts.yml |
| 44 | + # Use the repository's default branch to find the matching run |
| 45 | + branch: ${{ github.event.repository.default_branch }} |
| 46 | + workflow_conclusion: success |
| 47 | + repo: ${{ github.repository }} |
| 48 | + path: . |
| 49 | + if_no_artifact_found: fail |
18 | 50 |
|
19 | | - - name: Download build artifacts |
20 | | - uses: actions/download-artifact@v4 |
21 | | - with: |
22 | | - name: model-tarballs |
23 | | - path: data |
| 51 | + - name: List downloaded files |
| 52 | + run: ls -lR |
24 | 53 |
|
25 | | - - name: Create GitHub Release and upload .tar.gz assets |
26 | | - id: create_release |
27 | | - uses: softprops/action-gh-release@v2 |
28 | | - with: |
29 | | - files: 'data/*.tar.gz' |
30 | | - env: |
31 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + - name: Upload files to this release |
| 55 | + uses: softprops/action-gh-release@v2 |
| 56 | + with: |
| 57 | + files: | |
| 58 | + data/*.tar.gz |
| 59 | + env: |
| 60 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments