Skip to content

chore:

chore: #55

Workflow file for this run

name: Semantic Release Pipeline
on:
push:
branches:
- main
- dev
- release
- release/** # Matches branches like "release/1.0.0"
- '*/release' # Matches branches like "1-release" or "2-release"
- 'release-*' # Matches branches like "release-1.0.0" or "release-2.5.1"
jobs:
version_bump:
name: Version Bump and Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
# Set up Node.js for Semantic Release
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install Python
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip
python3 --version
# Set Git user details for version bumps
- name: Configure Git User
run: |
git config --global user.email "abarmardeatashyne@gmail.com"
git config --global user.name "wildonion"
# Fetch full history and tags
- name: Fetch Full Git History
run: |
git fetch --all --tags --prune
# Delete local tags to ensure no cached tags remain
- name: Delete Local Tags
run: git tag -d $(git tag) || true
# Refetch remote tags after deletion
- name: Refetch Remote Tags
run: git fetch --tags
# Extract version from Cargo.toml and store it in GITHUB_ENV
- name: Extract Version from Cargo.toml
id: extract_version
run: |
package_version=$(grep -Po '(?<=^version = ").*(?=")' Cargo.toml)
echo "PACKAGE_VERSION=$package_version" >> $GITHUB_ENV # Store in GITHUB_ENV
# Check if any tags exist and create a tag if none exist
- name: Check and Create Tag if None Exist
run: |
if [ -z "$(git tag)" ]; then
echo "No tags found, creating initial tag from Cargo.toml version, from now on semantic-release uses this tag"
git tag "v${{ env.PACKAGE_VERSION }}" # Use the PACKAGE_VERSION stored in GITHUB_ENV
git push origin "v${{ env.PACKAGE_VERSION }}"
else
echo "Tags found, semantic-release uses this tag to bump version"
fi
# Install semantic-release and the exec plugin
- name: Install Dependencies
run: npm install semantic-release @semantic-release/exec @semantic-release/git @semantic-release/github --save-dev
# Run Semantic Release with version bumping
- name: Run Semantic Release
run: npx semantic-release --ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub access token for authentication
# publish-package:
# name: Publish Package to Crate
# runs-on: ubuntu-latest