| | @@ -1,6 +1,7 @@ |
| 1 | 1 | # Checks every push to main. A pushed tag vX.Y.Z is checked too and |
| 2 | 2 | # becomes a GitHub release, with a tarball of raz, the lib/ it reads |
| 3 | 3 | # beside itself, and the manual pages. Run by hand with a tag, it releases an older tag. |
| 4 | +# Actions are pinned by commit; only the release job may write. |
| 4 | 5 | name: ci |
| 5 | 6 | on: |
| 6 | 7 | push: |
| | @@ -12,30 +13,37 @@ |
| 12 | 13 | description: the tag to release |
| 13 | 14 | required: true |
| 14 | 15 | permissions: |
| 15 | | - contents: write |
| 16 | + contents: read |
| 17 | +env: |
| 18 | + TAG: ${{ inputs.tag || (github.ref_type == 'tag' && github.ref_name) || '' }} |
| 16 | 19 | jobs: |
| 17 | 20 | check: |
| 18 | 21 | runs-on: ubuntu-24.04 |
| 19 | | - env: |
| 20 | | - TAG: ${{ inputs.tag || (github.ref_type == 'tag' && github.ref_name) || '' }} |
| 21 | 22 | steps: |
| 22 | | - - uses: actions/checkout@v4 |
| 23 | + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 |
| 23 | 24 | with: |
| 24 | 25 | ref: ${{ inputs.tag || github.ref }} |
| 25 | 26 | fetch-depth: 0 # git describe needs the tags |
| 27 | + persist-credentials: false |
| 26 | 28 | # musl and musl-tools: test/libc over musl, and cabi with musl-gcc |
| 27 | 29 | - run: sudo apt-get update && sudo apt-get install -y musl musl-tools |
| 28 | | - # src/boot.sh fetches the release BOOT names, by gh where the |
| 29 | | - # repository is private |
| 30 | 30 | - run: make check |
| 31 | | - env: |
| 32 | | - GH_TOKEN: ${{ github.token }} |
| 33 | 31 | - run: make alpine |
| 34 | | - - name: release |
| 35 | | - if: env.TAG != '' |
| 36 | | - env: |
| 32 | + release: |
| 33 | + needs: check |
| 34 | + if: inputs.tag || github.ref_type == 'tag' |
| 35 | + runs-on: ubuntu-24.04 |
| 36 | + permissions: |
| 37 | + contents: write |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 |
| 40 | + with: |
| 41 | + ref: ${{ inputs.tag || github.ref }} |
| 42 | + fetch-depth: 0 |
| 43 | + persist-credentials: false |
| 44 | + - env: |
| 37 | 45 | GH_TOKEN: ${{ github.token }} |
| 38 | 46 | run: | |
| 39 | | - make dist |
| 47 | + make raz dist |
| 40 | 48 | gh release create "$TAG" build/raz-${TAG#v}-linux-x86_64.tar.gz --verify-tag \ |
| 41 | 49 | --title "raz ${TAG#v}" --notes "$(./raz --version)" |