diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml new file mode 100644 index 0000000..9686f26 --- /dev/null +++ b/.github/workflows/windows-build.yml @@ -0,0 +1,52 @@ +name: Build, Package, and Release (Rust) + +on: + push: + branches: + - add-Windows-build-action + pull_request: + +jobs: + build-and-release: + runs-on: windows-latest + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Install Rust toolchain + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + $env:Path += ";$HOME\.cargo\bin" + rustup install stable + rustup default stable + + - name: Build the project + run: cargo build --release + + - name: Package build artifacts + run: | + mkdir release + Copy-Item target\release\* release\ + Compress-Archive -Path release\* -DestinationPath release\artifacts.zip + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: windows-build-${{ github.run_id }} + release_name: "Windows Build #${{ github.run_number }}" + draft: false + prerelease: true + + - name: Upload Release Artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: release/artifacts.zip + asset_name: artifacts.zip + asset_content_type: application/zip \ No newline at end of file