Skip to content

feat: init

feat: init #2

name: Linux/Windows/macOS (Build/Test/Release)
on:
push:
branches: [ main, next ]
pull_request:
branches: [ main, next ]
jobs:
build_test_common_os:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
toolchain: [stable]
feature: [ no_feature ]
steps:
- uses: actions/checkout@v3
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- name: Setup Feature Args
shell: bash
run: |
if [[ "${{ matrix.feature }}" == "no_feature" ]]; then
echo "FEATURE_ARGS=" >> $GITHUB_ENV
else
echo "FEATURE_ARGS=-F ${{ matrix.feature }}" >> $GITHUB_ENV
fi
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: ${{ env.FEATURE_ARGS }}
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: ${{ env.FEATURE_ARGS }}
release:
name: Release
runs-on: ubuntu-latest
needs: [build_test_common_os]
if: github.ref == 'refs/heads/main'
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: main
- name: install npm
uses: actions/setup-node@v3
with:
node-version: '16'
- name: install @semantic-release/exec
run: npm install @semantic-release/exec
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
with:
branch: main
env:
GITHUB_TOKEN: ${{ secrets.PAT_GLOBAL }}
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}