fix(ci): add permissions block to release workflow for least privilege #1
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: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| crates-io: | |
| name: Publish to crates.io | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Publish hsrs-macros | |
| run: cargo publish -p hsrs-macros --token ${{ secrets.CRATES_IO_TOKEN }} | |
| - name: Wait for crates.io index | |
| run: sleep 30 | |
| - name: Publish hsrs | |
| run: cargo publish -p hsrs --token ${{ secrets.CRATES_IO_TOKEN }} | |
| - name: Wait for crates.io index | |
| run: sleep 30 | |
| - name: Publish hsrs-codegen | |
| run: cargo publish -p hsrs-codegen --token ${{ secrets.CRATES_IO_TOKEN }} | |
| hackage: | |
| name: Publish to Hackage | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: hsrs-haskell | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: haskell-actions/setup@v2 | |
| with: | |
| ghc-version: "9.6" | |
| cabal-version: "3.10" | |
| - name: Build sdist | |
| run: cabal sdist | |
| - name: Upload to Hackage | |
| run: cabal upload --publish dist-newstyle/sdist/hsrs-*.tar.gz --token ${{ secrets.HACKAGE_TOKEN }} |