スキップしてメイン コンテンツに移動

Rust を Windows 環境でビルドし GitHub のリリースを作成する

以下のようなファイルを作っておくと、v1.0.0 のようなタグを作ったときに勝手にコンパイルしリリース作業を実行してくれる。
この GitHub Actions の為のトークンの準備などは不要。

.github/workflows/release.yml

name: Release permissions: contents: write on: push: tags: - "v*.*.*" jobs: release: runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable target: x86_64-pc-windows-msvc override: true profile: minimal - name: Build uses: actions-rs/cargo@v1 with: use-cross: false command: build args: --release --target x86_64-pc-windows-msvc - name: Zip run: powershell Compress-Archive -Path README.md, target\x86_64-pc-windows-msvc\release\my_program.exe -DestinationPath my_program.zip - name: Release uses: softprops/action-gh-release@v2 with: files: | my_program.zip additional_file_if_any_you_would_like_to_publish_separately_from_the_zip_file.txt

コメント