Skip to content

update workflow

update workflow #3

Workflow file for this run

name: Create Release
on:
push:
branches: [ main ]
permissions:
contents: write
jobs:
release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# Try to download artifacts from PR build
- name: Download PR artifacts
id: download
uses: dawidd6/action-download-artifact@v2
continue-on-error: true
with:
workflow: build.yml
workflow_conclusion: success
name: build-artifacts-${{ github.sha }}
path: artifacts
# Verify SHA matches
- name: Verify build SHA
id: verify
if: steps.download.outcome == 'success'
run: |
$expected_sha = Get-Content artifacts/SHA.txt
if ($expected_sha -ne "${{ github.sha }}") {
echo "SHA mismatch - need fresh build"
exit 1
}
- name: Install Rust
if: steps.download.outcome == 'failure' || steps.verify.outcome == 'failure'
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies and build outputs
if: steps.download.outcome == 'failure' || steps.verify.outcome == 'failure'
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build
if: steps.download.outcome == 'failure' || steps.verify.outcome == 'failure'
run: cargo build --release
- name: Move build artifacts
if: steps.download.outcome == 'failure' || steps.verify.outcome == 'failure'
run: |
mkdir artifacts
move target/release/*.exe artifacts/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/*.exe
tag_name: release-${{ github.sha }}
name: Release ${{ github.sha }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}