Skip to content

Commit

Permalink
Add release CICD
Browse files Browse the repository at this point in the history
  • Loading branch information
lemaitre-aneo committed Jun 1, 2024
1 parent 641d552 commit c7e9603
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
release:
types:
- prereleased
- released

name: Release

env:
TAG: ${{ github.event.release.tag_name }}

jobs:
check-version:
name: Check Version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Version
run: |
set -ex
cargo_version="$(sed -n 's/^version\s*=\s*"\(.*\)"\s*$/\1/p' Cargo.toml)"
test "$cargo_version" = "${TAG#v}"
test:
name: Test
needs: check-version
uses: ./.github/workflows/test.yml

publish:
name: Publish
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: protoc,sccache
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
- name: Package
run: |
cargo package
- name: Publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish
failure:
needs: [check-version, test, publish]
if: cancelled() || failure()
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Remove tag
run: |
git push --delete origin "$TAG"
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_call:

name: Test

Expand Down

0 comments on commit c7e9603

Please sign in to comment.