Update Jenkinsfile

This commit is contained in:
egelhaus 2025-04-14 19:40:30 +02:00 committed by GitHub
parent f92a24e052
commit 6b6ce501a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 9 deletions

10
Jenkinsfile vendored
View File

@ -4,6 +4,7 @@ pipeline {
environment {
NODE_VERSION = '20.17.0'
PR_NUMBER = "${env.CHANGE_ID}" // PR number comes from webhook payload
IMAGE_TAG="ghcr.io/gitroomhq/postiz-app-pr:${env.CHANGE_ID}"
}
stages {
@ -40,24 +41,15 @@ pipeline {
}
steps {
withCredentials([string(credentialsId: 'gh-pat', variable: 'GITHUB_PASS')]) {
// Docker login step
sh '''
echo "$GITHUB_PASS" | docker login ghcr.io -u "egelhaus" --password-stdin
'''
// Set image tag dynamically based on the PR number
sh '''
IMAGE_TAG="ghcr.io/gitroomhq/postiz-app-pr:$PR_NUMBER"
echo "IMAGE_TAG=$IMAGE_TAG" >> image.env
'''
// Build Docker image
sh '''
source image.env
docker build -f Dockerfile.dev -t $IMAGE_TAG .
'''
// Push Docker image to GitHub Container Registry
sh '''
source image.env