Fix permissions for release upload. #8
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: Windows Build and Release | |
| permissions: | |
| contents: write | |
| on: | |
| push: # Run on every push | |
| branches: | |
| - main | |
| - develop | |
| - 'feature/*' # Optional: Runs on feature branches | |
| tags: | |
| - 'v*' # Triggers release only on version tags | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-pc-windows-msvc # Or x86_64-pc-windows-gnu if needed | |
| - name: Cache Cargo dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build binary | |
| run: cargo build --release | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-binary | |
| path: target/release/*.exe | |
| retention-days: 7 # Keep artifacts for 7 days | |
| - name: Release | |
| uses: svenstaro/upload-release-action@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: target/release/*.exe | |
| tag: ${{ github.ref }} | |
| overwrite: true | |
| file_glob: true |