Files
Dagen BrockandClaude Fable 5 9ec1b36958 Modernize release workflow permissions and pinning
Scope contents:write to the release job only, SHA-pin third-party
actions, add fail-fast:false, workflow_dispatch, and auto-generated
release notes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-26 21:10:26 -05:00

69 lines
1.9 KiB
YAML

name: Release Builds
on:
push:
workflow_dispatch:
permissions:
contents: read
jobs:
build-and-store-artifact:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
steps:
- uses: actions/checkout@v7
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
if: matrix.os == 'windows-latest'
- name: Make GNU
if: matrix.os != 'windows-latest'
working-directory: ./src
run: make
shell: bash
- name: Make Windows
if: matrix.os == 'windows-latest'
working-directory: ./src
run: nmake
- name: Test
shell: bash
run: cd tests && ./test.sh
- name: Package NIX
if: matrix.os != 'windows-latest'
run: zip --junk-paths ${{ format('b2d-{0}.zip', matrix.os) }} b2d README.md
- name: Package WIN
if: matrix.os == 'windows-latest'
run: 7z.exe a ${{ format('b2d-{0}.zip', matrix.os) }} b2d.exe README.md
- name: Upload binary artifact
uses: actions/upload-artifact@v7
with:
name: ${{ format('b2d-{0}', matrix.os) }}
path: ${{ format('b2d-{0}.zip', matrix.os) }}
create-release:
if: startsWith(github.ref, 'refs/tags/v')
name: Create Release
needs: build-and-store-artifact
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download binary artifacts
uses: actions/download-artifact@v8
with:
pattern: b2d-*
merge-multiple: true
- name: Add tag to asset names
run: |
for f in b2d-*.zip; do
mv "$f" "${f%.zip}-${{ github.ref_name }}.zip"
done
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
with:
name: Release ${{ github.ref_name }}
generate_release_notes: true
files: b2d-*.zip