Skip to content

run actions on windows instead 🪟 #5

run actions on windows instead 🪟

run actions on windows instead 🪟 #5

Workflow file for this run

name: Build and Release
on:
push:
branches: [master] # Trigger only on pushes to the main branch
jobs:
build-and-release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
override: true
- name: Extract version from Cargo.toml
id: extract_version
run: |
Get-Content Cargo.toml | Select-String -Pattern '^version\s*=\s*"([^"]+)"' | ForEach-Object { $_.Matches[0].Groups[1].Value } | Set-Content -Path version.txt
echo ::set-output name=version::$(Get-Content version.txt)
- name: Get latest release version
id: get_latest_release
uses: octokit/request-action@v2.x
with:
route: GET /repos/${{ github.repository }}/releases/latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build binaries
if: ${{ steps.extract_version.outputs.version != steps.get_latest_release.outputs.data.tag_name }}
run: |
rustup target add x86_64-pc-windows-gnu
cargo build --release --target x86_64-pc-windows-gnu
- name: Create release
if: ${{ steps.extract_version.outputs.version != steps.get_latest_release.outputs.data.tag_name }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.extract_version.outputs.version }}
release_name: Release ${{ steps.extract_version.outputs.version }}
body: |
## Changes
## Downloads
- **Windows binary:** [link to Windows binary]
- **Linux binary:** [link to Linux binary]
draft: false
prerelease: false