Skip to content

Commit

Permalink
feat: auto-release ci on tag
Browse files Browse the repository at this point in the history
  • Loading branch information
kkharji committed Jun 22, 2022
1 parent 43d0f2b commit c4d1de3
Showing 1 changed file with 38 additions and 5 deletions.
43 changes: 38 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: release
name: Release
on:
push:
tags: "v*"
tags: "v*.*.*"

jobs:
release:
Release:
name: Publish release note
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/[email protected]
Expand All @@ -15,12 +17,12 @@ jobs:
- name: Show Tag
id: tag
run: echo ::set-output name=TAG::${GITHUB_REF##*/}
- name: Generate Changelog
- name: Generate Release Changelog
uses: orhun/git-cliff-action@v1
id: git-cliff
with:
config: .github/workflows/cliff.toml
args: -v --strip all --current
args: -v --strip all --latest
env:
OUTPUT: CHANGELOG.md
- name: Create GitHub release
Expand All @@ -29,3 +31,34 @@ jobs:
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

0 comments on commit c4d1de3

Please sign in to comment.