on:
push:
branches:
- master
- staging
- develop
name: Continuous integration
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
rust:
- stable
- beta
- nightly
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all
release-master: if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- run: git fetch --all --tags
- name: Check Release Version
uses: thebongy/version-check@v1
with:
file: Cargo.toml
tagFormat: v${version}
id: version_check
- name: Publish Release
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CRATES_IO_TOKEN }}
release-staging:
if: github.ref == 'refs/heads/staging'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- run: git fetch --all --tags
- name: Check Release Version
uses: thebongy/version-check@v1
with:
file: Cargo.toml
tagFormat: v${version}-beta
id: version_check
- name: Find and Replace
run: sed -i -e 's/version = "${{ steps.version_check.outputs.rawVersion }}"/version = "${{ steps.version_check.outputs.rawVersion }}-beta"/g' Cargo.toml
- name: Publish Release
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty