Files
minesweeper/.gitea/workflows/build-windows.yaml
Avii 11297c9a56
Some checks failed
build / Create Release (push) Failing after 2s
build / publish (tar.gz, x86_64-unknown-linux-gnu, ubuntu-latest, linux-x86_64) (push) Has been skipped
build / publish (zip, x86_64-pc-windows-msvc, windows-2022, windows-x86_64) (push) Has been skipped
publish
2024-07-12 12:55:35 +02:00

73 lines
2.3 KiB
YAML

name: build
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Create Release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
with:
tag_name: "${{ gitea.event.repository.name }} ${{ gitea.ref }}"
release_name: "${{ gitea.event.repository.name }} ${{ gitea.ref }}"
draft: false
prerelease: false
publish:
name: publish
needs:
- release
strategy:
fail-fast: true
matrix:
include:
- suffix: windows-x86_64
platform: windows-2022
archive: zip
name: x86_64-pc-windows-msvc
- suffix: linux-x86_64
platform: ubuntu-latest
archive: tar.gz
name: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.platform }}
steps:
- name: Setup Rust toolchain and cache
if: matrix.platform != 'windows-2022'
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
- name: Ensure rust is up to date
if: matrix.platform == 'windows-2022'
run: |
rustup update
rustup toolchain install nightly
- uses: actions/checkout@v4
- name: Create output directory
run: mkdir -f output
- name: Build release
run: cargo +nightly -Z unstable-options b -r --artifact-dir ./output
- name: Collect windows artifacts
if: matrix.platform == 'windows-2022'
run: |
cp -r -fo assets $env:GITEA_WORKSPACE/output/
Compress-Archive -Path $env:GITEA_WORKSPACE/output/* -DestinationPath $env:GITEA_WORKSPACE/${{ gitea.event.repository.name }}_${{ matrix.name }}.${{ matrix.archive }}
- name: Collect linux/macos artifacts
if: matrix.platform != 'windows-latest'
run: |
cp -rf assets ${GITEA_WORKSPACE}/output/
tar -czvf ${GITHUB_WORKSPACE}/${{ gitea.event.repository.name }}_${{ matrix.name }}.${{ matrix.archive }} -C ${GITHUB_WORKSPACE}/output/ .
- name: Upload artifacts
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "${{ gitea.event.repository.name }}_${{ matrix.name }}.${{ matrix.archive }}"