Merge pull request #73 from sai80082/CI/CD

ci: updated workflow
This commit is contained in:
Varun Raj Manoharan authored and GitHub committed 2024-11-30 17:15:41 +05:30
commit 9aa9fd3799
2 files changed
+13 -2

No files matched your search

+8 -2
View File
@@ -7,6 +7,8 @@ on:
jobs:
release:
# Only run on the original repository, not forks
if: ${{ github.repository_owner == 'varun-raj' }}
runs-on: ubuntu-latest
permissions:
contents: write
@@ -32,7 +34,7 @@ jobs:
contents: read
packages: write
needs: release
if: needs.release.outputs.new-release-published == 'true'
if: always() && !failure()
steps:
- uses: actions/checkout@v3
- uses: docker/metadata-action@v5
@@ -42,7 +44,8 @@ jobs:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{major}}.{{minor}}.{{patch}}
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' }}
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
@@ -56,6 +59,9 @@ jobs:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ needs.release.outputs.new-release-version || 'dev' }}
+5
View File
@@ -20,6 +20,11 @@ RUN npm run build
# Production image, copy all the files and run next
FROM node:18-alpine AS runner
WORKDIR /app
# Define a build argument
ARG VERSION=dev
# Set the build argument as an environment variable
ENV VERSION=$VERSION
ENV NODE_ENV=production