Skip to content

Commit

Permalink
Merge pull request #152 from tkrs/release-on-github
Browse files Browse the repository at this point in the history
ci: release on GitHub Actions
  • Loading branch information
tkrs committed Mar 19, 2023
2 parents d17dcad + 86463f3 commit f6c3b49
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
workflow_dispatch:

jobs:
release-crate:
environment: release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup git user
run: |
git config --global user.email "type.in.type@gmail.com"
git config --global user.name "Takeru Sato"
- run: git submodule update --init --recursive
- name: Install rust toolchain stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable-x86_64-unknown-linux-gnu
override: true
- name: Setup Node.js
uses: actions/setup-node@v3
- run: sudo npm install -g standard-version
- name: Determine tag and generate release body
run: standard-version --infile RELEASE_BODY.md --skip.commit
- name: Generate release context
id: release_context
run: |
tag="$(git describe HEAD --abbrev=0)"
echo "tag_name=$tag" >>$GITHUB_OUTPUT
echo "version=${tag/v/}" >>$GITHUB_OUTPUT
git tag -d "${tag}"
- name: Install cargo-release
uses: taiki-e/install-action@v2
with:
tool: cargo-release
- run: cargo release ${{ steps.release_context.outputs.version }} --execute --no-confirm
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
- name: Create release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ steps.release_context.outputs.tag_name }}
tag_name: ${{ steps.release_context.outputs.tag_name }}
body_path: RELEASE_BODY.md
14 changes: 14 additions & 0 deletions .versionrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"types": [
{ "type": "feat", "section": "Feature" },
{ "type": "build", "section": "Build" },
{ "type": "ci", "section": "CI/CD" },
{ "type": "fix", "section": "Bug Fixes" },
{ "type": "chore", "section": "Maintenance" },
{ "type": "docs", "section": "Documentation" },
{ "type": "refactor", "section": "Refactor" },
{ "type": "perf", "section": "Performance Improvement" },
{ "type": "style", "hidden": true },
{ "type": "test", "hidden": true }
]
}

0 comments on commit f6c3b49

Please sign in to comment.