on:
push:
tags: "*"
name: Release
jobs:
release_bin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: "Set version"
run: |
sed '0,/version/s/version = .*/version = "${{ env.RELEASE_VERSION }}"/' -i Cargo.toml
- name: "Check package"
uses: actions-rs/cargo@v1
with:
command: check
- name: "Commit version"
run: |
git config --global user.name 'Release Action'
git config --global user.email 'g4s8.public@gmail.com'
git add Cargo.toml Cargo.lock
git commit -m "release: ${{ env.RELEASE_VERSION }}"
git push origin HEAD:master
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: "Build lib"
uses: actions-rs/cargo@v1
with:
command: build
args: --release --lib
- name: "Publish lib"
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CRATES_TOKEN }}
- name: "Build bin"
uses: actions-rs/cargo@v1
with:
command: build
args: --release --bin commentator --features feat-bin
- name: "Create release"
uses: softprops/action-gh-release@v1
with:
files: target/release/commentator