Skip to content

Commit

Permalink
add cargo-release
Browse files Browse the repository at this point in the history
  • Loading branch information
Javagedes committed Oct 6, 2024
1 parent 4fb54d1 commit f661315
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/cargo-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Upload to Cargo

on:
release:
types: [published]

jobs:
publish:
name: Publish to Crates.io

runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: 'main'

- name: Download Rust Tools
uses: ./.github/actions/install-rust-tools

- name: Extract tag version
run: |
TAG=${GITHUB_REF##*/}
VERSION=${TAG#v}
echo "Version: $VERSION"
echo "version=$VERSION" >> $GITHUB_ENV
- name: Update version in Cargo.toml
run: |
sed -i -E "s/^version = \".*\"/version = \"${{ env.version }}\"/" Cargo.toml
- name: Commit version update
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add Cargo.toml
git commit -m "Update version to ${{ env.version }}"
git push origin main

0 comments on commit f661315

Please sign in to comment.