Merge pull request #3 from devqik/fix-buggy-remote-backend-detection #16
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+*' | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Run tests | |
run: cargo test --all-features | |
publish-crate: | |
name: Publish to crates.io | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Publish to crates.io | |
continue-on-error: true | |
run: | | |
cargo publish --token ${CRATES_TOKEN} || echo "Crate version already exists, continuing with release" | |
env: | |
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} | |
build-and-release: | |
name: Build and Release | |
needs: publish-crate | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Build binary | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Package Binary (Unix) | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release | |
tar czvf ../../../solarboat-${{ matrix.target }}.tar.gz solarboat | |
cd - | |
- name: Package Binary (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release | |
7z a ../../../solarboat-${{ matrix.target }}.zip solarboat.exe | |
cd - | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-${{ matrix.target }} | |
path: | | |
solarboat-*.tar.gz | |
solarboat-*.zip | |
create-release: | |
name: Create Release | |
needs: build-and-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: binaries-* | |
merge-multiple: true | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
solarboat-*.tar.gz | |
solarboat-*.zip | |
generate_release_notes: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |