Skip to content

Commit

Permalink
Merge pull request #23 from sacconazzo:develop
Browse files Browse the repository at this point in the history
tag new versions
  • Loading branch information
sacconazzo authored Aug 1, 2024
2 parents a6a40ba + 2a2f358 commit 20efb61
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release

on:
push:
tags:
- 'v[0-9]*'

permissions:
contents: write

jobs:
release:
name: Release tag
runs-on: ubuntu-22.04
steps:
- name: Create new release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="$Release ${tag}" \
--generate-notes
21 changes: 21 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,27 @@ pipeline {
sh "docker compose --env-file ${BASE_CONFIG_PATH}${env.JOB_NAME}.env up -d"
}
}
stage('Versioning') {
steps {
withCredentials([usernamePassword(credentialsId: 'sacconazzo', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
script {
def packageJson = readJSON file: 'package.json'
VERSION = packageJson.version
echo "Project version: ${VERSION}"
def tagExists = sh(script: "git show-ref --tags | grep -q 'refs/tags/v${VERSION}'", returnStatus: true) == 0
if (tagExists) {
echo "Tag v${VERSION} already exists"
} else {
echo "Creating tag for v${VERSION}"
sh "git tag -a 'v${VERSION}' -m 'Release ${VERSION}'"
sh '''
git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/sacconazzo/directus-monorepo-cicd-boilerplate.git --tags
'''
}
}
}
}
}
stage('Cleanup') {
steps {
sh 'docker builder prune -f'
Expand Down

0 comments on commit 20efb61

Please sign in to comment.