Skip to content

Commit

Permalink
ci/cd: release on push
Browse files Browse the repository at this point in the history
* Create a github release on release tag push
* Publish to crates.io
  • Loading branch information
ririsoft committed Jun 16, 2024
1 parent 674aab8 commit 76961de
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release
on:
push:
tags: [ "v[0-9]+.*" ]

permissions:
contents: write

jobs:
create-release:
if: github.repository_owner == 'ririsoft'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/create-gh-release-action@v1
with:
changelog: CHANGELOG.md
title: $version
token: ${{ secrets.GITHUB_TOKEN }}

publish-release:
if: github.repository_owner == 'ririsoft'
needs:
- create-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: Verify package can be published
run: cargo publish --dry-run

- name: Publish package to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
push:
branches:
- master
tags-ignore:
- "v[0-9]+.*"
pull_request:
branches:
- master
Expand Down

0 comments on commit 76961de

Please sign in to comment.