-
Notifications
You must be signed in to change notification settings - Fork 38
54 lines (51 loc) · 1.86 KB
/
create-tag.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Create release tag
on:
workflow_dispatch:
inputs:
release-version:
description: 'Version to create/release (for example 1.0.0)'
required: true
env:
# Personal access token is needed so that this action can create other action (release)
GITHUB_TOKEN: ${{ secrets.PAT }}
jobs:
create-tag:
name: Create tag
runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ inputs.release-version }}
DEV_VERSION: 1.0-SNAPSHOT
JBANG_FILE: jbang/tnb.java
SYSTEM_X_ALL: system-x-all
steps:
- uses: actions/checkout@v3
with:
token: ${{ env.GITHUB_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Init Git info
run: |
git config --global user.email "actions@workflow.github.com"
git config --global user.name "GitHub Actions"
- name: Update versions
run: |
mvn --no-transfer-progress versions:set -DnewVersion=${RELEASE_VERSION} -DoldVersion=* -DgroupId=* -DartifactId=* -DgenerateBackupPoms=false
sed -i "s/${SYSTEM_X_ALL}:${DEV_VERSION}/${SYSTEM_X_ALL}:${RELEASE_VERSION}/" ${JBANG_FILE}
- name: Create tag
run: |
git add -A
git commit -m "[Release] Release ${RELEASE_VERSION}"
git tag v${RELEASE_VERSION}
- name: Revert versions
run: |
mvn --no-transfer-progress versions:set -DnewVersion=${DEV_VERSION} -DoldVersion=* -DgroupId=* -DartifactId=* -DgenerateBackupPoms=false
sed -i "s/${SYSTEM_X_ALL}:${RELEASE_VERSION}/${SYSTEM_X_ALL}:${DEV_VERSION}/" ${JBANG_FILE}
- name: Push changes
run: |
git add -A
git commit -m "[Release] Back to ${DEV_VERSION}"
git push origin main
git push origin v${RELEASE_VERSION}