Skip to content

Commit

Permalink
feat: implement release tagging git workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ducpm511 committed Jun 30, 2024
1 parent 2e8dcc0 commit 3adeb9e
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/release-tagging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Release Tagging

on:
push:
branches:
- feat/release-tagging

jobs:
tagging:
runs-on: ubuntu-latest
env:
EXCLUDED_PACKAGE_OA_RENDERERS: '!./packages/vckit-oa-renderers/'
EXCLUDED_PACKAGE_CREDENTIAL_OA: '!./packages/credential-oa/'
EXCLUDED_PACKAGE_EXPLORER: '!./packages/demo-explorer/'

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install pnpm
run: npm i pnpm --global

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Get version from package.json
id: get_version
run: |
version=$(jq -r '.version // empty' < package.json)
if [ -z "$version" ]; then
echo "No valid version found in package.json."
exit 1
fi
echo "::set-output name=version::$version"
- name: Check if tag already exists
id: check_tag
run: |
version=${{ steps.get_version.outputs.version }}
if git rev-parse "v$version" >/dev/null 2>&1; then
echo "Tag v$version already exists."
echo "::set-output name=exists::true"
exit 0
else
echo "::set-output name=exists::false"
fi
- name: Create and push tag
if: steps.check_tag.outputs.exists == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ steps.get_version.outputs.version }}" -m "Release version ${{ steps.get_version.outputs.version }}"
git push origin "v${{ steps.get_version.outputs.version }}"
- name: Create GitHub Release
if: steps.check_tag.outputs.exists == 'false'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ steps.get_version.outputs.version }}"
release_name: "Release ${{ steps.get_version.outputs.version }}"
body: "Automatically generated release notes for version ${{ steps.get_version.outputs.version }}"
draft: false
prerelease: false

0 comments on commit 3adeb9e

Please sign in to comment.