name: Release
on:
push:
tags: "v*.*.*"
jobs:
Release:
name: Publish release note
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
with:
fetch-depth: 0
- name: Show Tag
id: tag
run: echo ::set-output name=TAG::${GITHUB_REF##*/}
- name: Generate Release Changelog
uses: orhun/git-cliff-action@v1
id: git-cliff
with:
config: .github/workflows/cliff.toml
args: -v --strip all --latest
env:
OUTPUT: CHANGELOG.md
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
body_path: ${{ steps.git-cliff.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Changelog
uses: orhun/git-cliff-action@v1
id: changelog
with:
config: .github/workflows/cliff.toml
args: -v
env:
OUTPUT: CHANGELOG.md
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Bump Version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_MSG: |
chore(release): ${{ steps.tag.outputs.TAG }}
See: https://github.com/${{ github.repository }}/releases/tag/${{ steps.tag.outputs.TAG }}
run: |
version="${{ steps.tag.outputs.TAG }}"
version="${version//v/}"
sed -i'' "s/^version.*$/version = \"$version\"/g" Cargo.toml
cargo update --workspace
git add CHANGELOG.md Cargo.toml Cargo.lock
git config --global user.name 'release[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git commit -m "${COMMIT_MSG}"
git push origin HEAD:master