ops: add missing step names #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | ||
name: CD | ||
"on": | ||
workflow_call: | ||
inputs: | ||
tag_name: | ||
required: true | ||
type: string | ||
permissions: | ||
id-token: write | ||
contents: read | ||
attestations: read | ||
env: | ||
ZIG_VERSION: 0.13.0 | ||
jobs: | ||
release: | ||
name: Create release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- name: Publish release | ||
uses: taiki-e/create-gh-release-action@v1 | ||
with: | ||
changelog: CHANGELOG.md | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
build-linux: | ||
name: Build / Linux | ||
runs-on: ubuntu-latest | ||
needs: [release] | ||
permissions: | ||
id-token: write | ||
contents: write | ||
attestations: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: | ||
- "x86-linux" | ||
- "x86_64-linux" | ||
- "aarch64-linux" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- name: Install Zig | ||
uses: goto-bus-stop/setup-zig@v2 | ||
with: | ||
version: ${{ env.ZIG_VERSION }} | ||
- name: Build | ||
run: | | ||
zig build -Dtarget=${{ matrix.target }} --release=safe | ||
mv zig-out/bin/xtxf xtxf | ||
tar -czvf xtxf-${{ matrix.target}}.tar.gz xtxf | ||
- name: Upload | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh release upload ${{ inputs.tag_name }} \ | ||
xtxf-${{ matrix.target }}.tar.gz | ||
- name: Attest | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-path: 'xtxf-${{ matrix.target}}.tar.gz' | ||
- name: Verify attestation | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh attestation verify xtxf-${{ matrix.target}}.tar.gz --owner "$GITHUB_REPOSITORY_OWNER" | ||
build-macos: | ||
name: Build / macOS | ||
runs-on: macos-latest | ||
needs: [release] | ||
permissions: | ||
id-token: write | ||
contents: write | ||
attestations: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: | ||
- "x86_64-macos" | ||
- "aarch64-macos" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- name: Install Zig | ||
uses: goto-bus-stop/setup-zig@v2 | ||
with: | ||
version: ${{ env.ZIG_VERSION }} | ||
- name: Build | ||
run: | | ||
zig build -Dtarget=${{ matrix.target }} --release=safe | ||
mv zig-out/bin/xtxf xtxf | ||
tar -czvf xtxf-${{ matrix.target }}.tar.gz xtxf | ||
- name: Upload | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh release upload ${{ inputs.tag_name }} \ | ||
xtxf-${{ matrix.target }}.tar.gz | ||
- name: Attest | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-path: 'xtxf-${{ matrix.target }}.tar.gz':w | ||
- name: Verify attestation | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh attestation verify xtxf-${{ matrix.target }}.tar.gz --owner "$GITHUB_REPOSITORY_OWNER" |