Skip to content

Commit

Permalink
Added: GitHub Actions workflow for versioning and releases
Browse files Browse the repository at this point in the history
Introduced `.github/workflows/main.yml` to automate version bumping and release creation on `main` branch pushes. Utilizes Node.js setup and `npm` for dependency management, with Git configuration for automated commits. Integrates `actions/create-release@v1` for publishing releases based on new tags.

Signed-off-by: Md. Sazzad Hossain Sharkar <md@szd.sh>
  • Loading branch information
SHSharkar committed Jan 4, 2025
1 parent b4617b1 commit 89b9729
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Create Tag and Publish Release

on:
push:
branches:
- main

permissions:
contents: write
repository-projects: write
deployments: write
packages: write
actions: write

jobs:
version_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm install
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump version
id: bump_version
run: |
NEW_VERSION=$(npm version patch -m "Bump version to %s")
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Push changes
run: |
git push origin main
git push origin --tags
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ steps.bump_version.outputs.new_version }}
release_name: Release ${{ steps.bump_version.outputs.new_version }}

0 comments on commit 89b9729

Please sign in to comment.