From 0442dd12fd8482bbaaaa45adb9e3700718744a61 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Mon, 16 Nov 2026 11:58:31 +0000 Subject: [PATCH] ci: actions pinned by commit; only the release job may write, in a job of its own - check job: contents read, no persisted credentials, no GH_TOKEN (boot fetches by curl now the repository is public) - release job: needs check, contents write, make raz dist --- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98dc9d5..ecc8474 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,7 @@ # Checks every push to main. A pushed tag vX.Y.Z is checked too and # becomes a GitHub release, with a tarball of raz, the lib/ it reads # beside itself, and the manual pages. Run by hand with a tag, it releases an older tag. +# Actions are pinned by commit; only the release job may write. name: ci on: push: @@ -12,30 +13,37 @@ description: the tag to release required: true permissions: - contents: write + contents: read +env: + TAG: ${{ inputs.tag || (github.ref_type == 'tag' && github.ref_name) || '' }} jobs: check: runs-on: ubuntu-24.04 - env: - TAG: ${{ inputs.tag || (github.ref_type == 'tag' && github.ref_name) || '' }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: ref: ${{ inputs.tag || github.ref }} fetch-depth: 0 # git describe needs the tags + persist-credentials: false # musl and musl-tools: test/libc over musl, and cabi with musl-gcc - run: sudo apt-get update && sudo apt-get install -y musl musl-tools - # src/boot.sh fetches the release BOOT names, by gh where the - # repository is private - run: make check - env: - GH_TOKEN: ${{ github.token }} - run: make alpine - - name: release - if: env.TAG != '' - env: + release: + needs: check + if: inputs.tag || github.ref_type == 'tag' + runs-on: ubuntu-24.04 + permissions: + contents: write + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + ref: ${{ inputs.tag || github.ref }} + fetch-depth: 0 + persist-credentials: false + - env: GH_TOKEN: ${{ github.token }} run: | - make dist + make raz dist gh release create "$TAG" build/raz-${TAG#v}-linux-x86_64.tar.gz --verify-tag \ --title "raz ${TAG#v}" --notes "$(./raz --version)" diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index e9dd302..071cb31 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -31,8 +31,8 @@ run: working-directory: registry steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: '24' cache: npm @@ -44,8 +44,8 @@ needs: registry runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: '24' cache: npm @@ -76,7 +76,7 @@ fi - name: Log in for publishing if: github.event_name == 'workflow_dispatch' && inputs.publish - uses: docker/login-action@v3 + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 with: registry: ${{ vars.RAZ_REGISTRY || 'raz-registry.lucelad.workers.dev' }} username: publisher