|
| 1 | +name: Build & attach tarballs on tag push |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: ['v[0-9]*'] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + id-token: write |
| 10 | + |
| 11 | +env: |
| 12 | + TAG: ${{ github.ref_name }} |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + include: |
| 19 | +# - { target: x86_64, os: ubuntu-24.04 } |
| 20 | + - { target: aarch64, os: ubuntu-24.04-arm } |
| 21 | +# - { target: arm, os: ubuntu-24.04-arm } |
| 22 | +# - { target: riscv64, os: ubuntu-24.04 } |
| 23 | +# - { target: ppc64le, os: ubuntu-24.04 } |
| 24 | +# - { target: s390x, os: ubuntu-24.04 } |
| 25 | +# - { target: loongarch64, os: ubuntu-24.04 } |
| 26 | + |
| 27 | + runs-on: ${{ matrix.os }} |
| 28 | + |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Install Podman |
| 33 | + run: sudo apt-get update && sudo apt-get install -y podman qemu-user-static |
| 34 | + |
| 35 | + - name: Login to GitHub Container Registry |
| 36 | + uses: redhat-actions/podman-login@v1 |
| 37 | + with: |
| 38 | + registry: ghcr.io |
| 39 | + username: ${{ github.repository_owner }} |
| 40 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + |
| 42 | + - name: Build distribution tarballs |
| 43 | +# run: ./dist.sh ${{ matrix.target }} |
| 44 | + run: mkdir dist && touch dist/mold-2.40.0-${{ matrix.target }}.tar.gz |
| 45 | + |
| 46 | + - uses: actions/upload-artifact@v4 |
| 47 | + with: |
| 48 | + name: ${{ matrix.target }} |
| 49 | + path: dist/mold-*.tar.gz |
| 50 | + |
| 51 | + publish: |
| 52 | + needs: build |
| 53 | + runs-on: ubuntu-latest |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - uses: actions/download-artifact@v4 |
| 58 | + with: |
| 59 | + path: dist |
| 60 | + pattern: * |
| 61 | + merge-multiple: true |
| 62 | + |
| 63 | + - name: Ensure release exists (create if missing) |
| 64 | + env: |
| 65 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + run: | |
| 67 | + set -e |
| 68 | + if gh release view "$TAG" >& /dev/null; then |
| 69 | + echo "Existing release found for $TAG" |
| 70 | + else |
| 71 | + echo "Creating draft release for $TAG" |
| 72 | + gh release create "$TAG" --draft \ |
| 73 | + --title "$TAG" \ |
| 74 | + --notes "Automated draft – fill the changelog later." |
| 75 | + fi |
| 76 | +
|
| 77 | + - name: Upload tarballs |
| 78 | + env: |
| 79 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + run: | |
| 81 | + gh release upload "$TAG" dist/* --clobber |
| 82 | + gh release view "$TAG" --json assets --jq '.assets[].name' |
0 commit comments