refactor: Migrate release process to tag-based

This commit is contained in:
sai80082 committed 2026-03-04 13:15:34 +05:30
1 parent 361bcb7430
commit 78ea55e6f5
3 files changed
+24 -88

No files matched your search

+24 -33
View File
@@ -1,42 +1,24 @@
name: ci
name: Release
on:
push:
branches:
- main
tags:
- "v*.*.*"
jobs:
release:
# Only run on the original repository, not forks
if: ${{ github.repository_owner == 'varun-raj' }}
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
new-release-published: ${{ steps.release.outputs.new-release-published }}
new-release-version: ${{ steps.release.outputs.new-release-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 22
- name: Run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: release
run: |
npm install
npx semantic-release
build:
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
packages: write
needs: release
if: always() && !failure()
steps:
- uses: actions/checkout@v3
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
- uses: docker/metadata-action@v5
name: Docker meta
id: meta
@@ -44,17 +26,19 @@ jobs:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ github.repository_owner != 'varun-raj' || needs.release.outputs.new-release-published == 'true' }}
type=semver,pattern={{major}}.{{minor}}.{{patch}},enable=${{ github.repository_owner == 'varun-raj' && needs.release.outputs.new-release-published == 'true' }}
type=raw,value=${{ needs.release.outputs.new-release-version }},enable=${{ needs.release.outputs.new-release-version != '' }}
type=raw,value=latest
type=semver,pattern={{major}}.{{minor}}.{{patch}}
type=raw,value=${{ github.ref_name }}
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker-build
uses: docker/build-push-action@v6
with:
context: .
@@ -65,4 +49,11 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ needs.release.outputs.new-release-version || 'dev' }}
VERSION=${{ steps.version.outputs.VERSION }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}