Add permissions for write access in release workflow #2
Workflow file for this run
This file contains hidden or 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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build for ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| artifact_name: mpfree | |
| asset_name: mpfree-linux | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact_name: mpfree.exe | |
| asset_name: mpfree-windows.exe | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Generate SHA-256 | |
| shell: bash | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| sha256sum ${{ matrix.artifact_name }} > ${{ matrix.asset_name }}.sha256 | |
| - name: Upload Binaries to Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| target/${{ matrix.target }}/release/${{ matrix.artifact_name }} | |
| target/${{ matrix.target }}/release/${{ matrix.asset_name }}.sha256 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |