Skip to content

Commit a0ba994

Browse files
authored
fix(ci): derive plugin release versions from tags (#16)
1 parent 7502470 commit a0ba994

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@ jobs:
3030
env:
3131
GH_TOKEN: ${{ secrets.DEPS_TOKEN }}
3232
run: bash .github/scripts/prepare-release.sh
33-
- name: Set dated development version
33+
- name: Set build version
3434
id: dev
3535
shell: bash
3636
run: |
37-
dev_version="DEV-$(date -u +%Y%m%d-%H%M)"
37+
dev_version="main-SNAPSHOT"
38+
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
39+
dev_version="DEV-$(date -u +%Y%m%d-%H%M)"
40+
fi
3841
mvn -B --no-transfer-progress -P'!deploy-live' org.codehaus.mojo:versions-maven-plugin:2.22.0:set \
3942
-DnewVersion="$dev_version" -DgenerateBackupPoms=false
4043
mvn -B --no-transfer-progress -P'!deploy-live' help:evaluate \
@@ -54,7 +57,8 @@ jobs:
5457
BUILD_VERSION: ${{ steps.dev.outputs.version }}
5558
run: python3 .github/scripts/plugin-artifact.py --jar "$ARTIFACT_PATH" --version "$BUILD_VERSION"
5659

57-
- uses: actions/upload-artifact@v7
60+
- if: github.event_name == 'pull_request'
61+
uses: actions/upload-artifact@v7
5862
with:
5963
name: ${{ steps.dev.outputs.name }}-${{ github.run_id }}-${{ github.run_attempt }}
6064
path: |

‎.github/workflows/maven-release.yml‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,13 @@ jobs:
5959
bash .github/scripts/prepare-release.sh
6060
fi
6161
62-
- name: Check Maven version and build
62+
- name: Set version from tag and build
6363
id: maven
6464
env:
6565
TAG: ${{ github.ref_name }}
6666
run: |
67-
version_file="$RUNNER_TEMP/maven-release-version"
68-
mvn -B --no-transfer-progress -P'!deploy-live' help:evaluate \
69-
-Dexpression=project.version -Doutput="$version_file"
70-
[[ "$(cat "$version_file")" == "${TAG#v}" ]] || {
71-
echo '::error::The tag must match project.version exactly.'
72-
exit 1
73-
}
67+
mvn -B --no-transfer-progress -P'!deploy-live' org.codehaus.mojo:versions-maven-plugin:2.22.0:set \
68+
-DnewVersion="${TAG#v}" -DgenerateBackupPoms=false
7469
mvn -B --no-transfer-progress -P'!deploy-live' help:evaluate \
7570
-Dexpression=project.build.finalName -Doutput="$RUNNER_TEMP/final-name"
7671
final_name=$(cat "$RUNNER_TEMP/final-name")

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>net.tfminecraft</groupId>
88
<artifactId>magic</artifactId>
9-
<version>0.2.0</version>
9+
<version>main-SNAPSHOT</version>
1010

1111
<properties>
1212
<maven.compiler.release>21</maven.compiler.release>

0 commit comments

Comments
 (0)