22name : Publish Project
33
44on :
5- push :
6- tags :
7- - " *"
5+ workflow_dispatch :
6+ inputs :
7+ version :
8+ description : ' Mod version'
9+ required : true
10+ release_type :
11+ description : ' Release type'
12+ type : choice
13+ default : ' beta'
14+ options :
15+ - ' release'
16+ - ' beta'
17+ - ' alpha'
18+
19+ env :
20+ # link to the changelog with a format code for the version
21+ CHANGELOG_LOCATION : " Changelog is available [here](https://github.com/${{ github.repository }}/releases/tag/AdvancedBackups-Patch-v${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }})"
22+ # Version of the mod
23+ FULL_VERSION : " ${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }}"
24+ # type of release
25+ NAME : " AdvancedBackups-Patch"
26+
27+ # Curseforge and Modrinth project IDs
28+ CURSEFORGE_PROJECT_ID : " 851103"
29+ MODRINTH_PROJECT_ID : " ipueNiWG"
830
931concurrency :
10- group : publish-${{ github.ref }}
32+ group : publish-${{ inputs.target_branch || github.ref }}
1133 cancel-in-progress : true
1234
1335jobs :
@@ -22,62 +44,59 @@ jobs:
2244 - name : Checkout Repository
2345 uses : actions/checkout@v6
2446 with :
25- ref : main
26- fetch-depth : 0
47+ ref : ${{ inputs.target_branch || github.ref }}
2748 fetch-tags : true
2849
29- - name : Extract version from tag
30- id : version
31- run : echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
50+ - name : Check if tag already exists
51+ run : |
52+ if git rev-parse --verify --quiet "v${{ github.event.inputs.version }}"; then
53+ echo "Version ${{ github.event.inputs.version }} already exists, aborting workflow."
54+ exit 1
55+ fi
3256
33- - name : Update mod_version in gradle.properties
34- run : sed -i "s/mod_version.*=.*/mod_version = ${{ steps.version.outputs.version }}/g" gradle.properties
57+ - name : Set version
58+ run : sed -i "s/mod_version.*=.*/mod_version = ${{ env.FULL_VERSION }}/g" gradle.properties
3559
3660 - name : Commit and push gradle.properties
3761 uses : stefanzweifel/git-auto-commit-action@v7
3862 with :
39- commit_message : " Bump version to v${{ steps.version.outputs.version }}"
63+ commit_message : " Bump version to v${{ env.FULL_VERSION }}"
64+ commit_options : ' --no-verify'
4065 file_pattern : gradle.properties
66+ tagging_message : " v${{ env.FULL_VERSION }}"
4167
42- - name : Setup Build
43- uses : ./.github/actions/build_setup
44-
45- - name : Build Project
46- run : ./gradlew --info build
47-
48- - name : Create GitHub Release
49- uses : ncipollo/release-action@v1.20.0
50- with :
51- artifacts : " build/libs/*"
52- generateReleaseNotes : true
53-
54- - name : Publish to CurseForge and Modrinth
68+ - name : Publish to Curseforge and Modrinth
5569 uses : Kir-Antipov/mc-publish@v3.3
5670 with :
57- # Only include this section if you wish to publish
58- # your assets on Modrinth.
59- modrinth-id : placeholder
60- modrinth-token : ${{ secrets.MODRINTH_TOKEN }}
61- modrinth-dependencies : |
62- G1ckZuWK(required)
63- Jrmoreqs(required)
64-
65- # Only include this section if you wish to publish
66- # your assets on CurseForge.
67- curseforge-id : placeholder
68- curseforge-token : ${{ secrets.CURSEFORGE_TOKEN }}
69- curseforge-dependencies : |
70- mixin-booter(required)
71- advanced-backups(required)
72-
71+ github-tag : " v${{ env.FULL_VERSION }}"
72+ github-generate-changelog : true
73+ github-draft : false
74+ github-prerelease : false
75+ github-token : ${{ secrets.GITHUB_TOKEN }}
76+ # modrinth-id: ${{ env.MODRINTH_PROJECT_ID }}
77+ # modrinth-token: "${{ secrets.MODRINTH_API_KEY }}"
78+ # modrinth-dependencies: |
79+ # G1ckZuWK(required)
80+ # Jrmoreqs(required)
81+ # curseforge-id: ${{ env.CURSEFORGE_PROJECT_ID }}
82+ # curseforge-token: "${{ secrets.CURSEFORGE_API_KEY }}"
83+ # curseforge-dependencies: |
84+ # mixin-booter(required)
85+ # advanced-backups(required)
7386 files : |
74- build/libs/!(*-@(dev|sources|javadoc)).jar
75- build/libs/*-@(dev|sources|javadoc).jar
76- loaders : forge
77- game-versions : 1.12.2
87+ build/libs/!(*-@(cleanroom|sources|javadoc|)).jar
88+ build/libs/*-@(cleanroom).jar
89+ build/libs/*-@(sources).jar
90+ name : " ${{ env.NAME }}-${{ env.FULL_VERSION }}.jar"
91+ changelog : " Changelog is available [here](https://github.com/${{github.repository}}/blob/main/CHANGELOG.md)"
92+ version : " ${{ github.event.inputs.version }}"
93+ version-type : " ${{ github.event.inputs.release_type }}"
94+ loaders : |
95+ forge
96+ game-versions : |
97+ 1.12.2
7898 java : |
99+ 8
79100 21
80101 22
81- version : ${{ steps.version.outputs.version }}
82- changelog : ${{ steps.changes.outputs.changes }}
83102 retry-attempts : 2
0 commit comments