From d1a8ec3c5be2e5f2a5ad352b104f8ad80cc28b85 Mon Sep 17 00:00:00 2001 From: Jan Jaden Schmidt Date: Wed, 20 Dec 2023 21:21:07 +0100 Subject: [PATCH 1/2] Added version and suffix to publish workflow --- .github/workflows/publish.yml | 46 ++++++++++++++--------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 96fb1f78..083c568e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,6 +12,15 @@ on: - alpha - beta - release + version: + description: 'Version number for this release' + required: true + default: '1.2.0' + type: string + suffix: + description: 'Suffix to this release' + required: false + type: string jobs: versioncommit: @@ -20,17 +29,10 @@ jobs: - uses: actions/checkout@v3 with: token: ${{ secrets.PAT }} - - - name: Read VERSION file - id: getversion - run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT - - name: Read SUFFIX file - id: getsuffix - run: echo "suffix=$(cat SUFFIX)" >> $GITHUB_OUTPUT - name: Replace version number with new version run: | - sed -i 's/public static final String VERSION.*/public static final String VERSION = "${{ steps.getversion.outputs.version }}";/' src/main/java/net/landofrails/landofsignals/LandOfSignals.java - sed -i '0,/"version":.*/s//"version": "${{ steps.getversion.outputs.version }}",/' ./umc.json + sed -i 's/public static final String VERSION.*/public static final String VERSION = "${{ inputs.version }}";/' src/main/java/net/landofrails/landofsignals/LandOfSignals.java + sed -i '0,/"version":.*/s//"version": "${{ inputs.version }}",/' ./umc.json - name: Commit and push changes run: | git config --global user.name "MarkenJaden" @@ -87,20 +89,14 @@ jobs: uses: juliangruber/read-file-action@v1.1.6 with: path: ./CHANGELOG.md - - name: Read VERSION file - id: getversion - run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT - - name: Read SUFFIX file - id: getsuffix - run: echo "suffix=$(cat SUFFIX)" >> $GITHUB_OUTPUT - name: Rename with suffix run: | ls ./build/libs/ - mv -n build/libs/LandOfSignals-${{matrix.branch}}-${{ steps.getversion.outputs.version }}.jar build/libs/LandOfSignals-${{matrix.branch}}-${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }}.jar + mv -n build/libs/LandOfSignals-${{matrix.branch}}-${{ inputs.version }}.jar build/libs/LandOfSignals-${{matrix.branch}}-${{ inputs.version }}${{ inputs.suffix }}.jar - uses: actions/upload-artifact@v3 with: name: LandOfSignals ${{matrix.branch}} - path: build/libs/LandOfSignals-${{matrix.branch}}-${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }}.jar + path: build/libs/LandOfSignals-${{matrix.branch}}-${{ inputs.version }}${{ inputs.suffix }}.jar - name: Upload ${{matrix.branch}} uses: Kir-Antipov/mc-publish@v3.3 with: @@ -116,10 +112,10 @@ jobs: curseforge-dependencies: | universal-mod-core | depends | * - files: build/libs/LandOfSignals-${{matrix.branch}}-${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }}.jar + files: build/libs/LandOfSignals-${{matrix.branch}}-${{ inputs.version }}${{ inputs.suffix }}.jar - name: LandOfSignals-${{matrix.branch}}-${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }} - version: ${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }} + name: LandOfSignals-${{matrix.branch}}-${{ inputs.version }}${{ inputs.suffix }} + version: ${{ inputs.version }}${{ inputs.suffix }} version-type: ${{ inputs.type }} changelog-file: ./CHANGELOG.md @@ -139,12 +135,6 @@ jobs: needs: [ build ] steps: - uses: actions/checkout@v3 - - name: Read VERSION file - id: getversion - run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT - - name: Read SUFFIX file - id: getsuffix - run: echo "suffix=$(cat SUFFIX)" >> $GITHUB_OUTPUT - uses: actions/download-artifact@v3 - run: mkdir upload - run: cp **/LandOfSignals-*.jar upload @@ -152,7 +142,7 @@ jobs: uses: Kir-Antipov/mc-publish@v3.3 with: # GitHub - github-tag: v${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }} + github-tag: v${{ inputs.version }}${{ inputs.suffix }} github-generate-changelog: true github-draft: false github-prerelease: false @@ -161,7 +151,7 @@ jobs: files: upload/LandOfSignals-*.jar - version: ${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }} + version: ${{ inputs.version }}${{ inputs.suffix }} version-type: ${{ inputs.type }} changelog-file: ./CHANGELOG.md From 54b93dee62ec2789549470e72aedfa59d9393e7c Mon Sep 17 00:00:00 2001 From: Jan Jaden Schmidt Date: Wed, 20 Dec 2023 21:33:50 +0100 Subject: [PATCH 2/2] Create version.yml --- .github/workflows/version.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/version.yml diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml new file mode 100644 index 00000000..de16d97b --- /dev/null +++ b/.github/workflows/version.yml @@ -0,0 +1,35 @@ +name: Change version pipeline + +on: + workflow_dispatch: + inputs: + version: + description: 'Version number for this release' + required: true + default: '1.2.0' + type: string + suffix: + description: 'Suffix to this release' + required: false + type: string + +jobs: + versioncommit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + token: ${{ secrets.PAT }} + - name: Replace version number with new version + run: | + sed -i 's/public static final String VERSION.*/public static final String VERSION = "${{ inputs.version }}";/' src/main/java/net/landofrails/landofsignals/LandOfSignals.java + sed -i '0,/"version":.*/s//"version": "${{ inputs.version }}",/' ./umc.json + echo ${{ inputs.version }} > .\VERSION + echo ${{ inputs.suffix }} > .\SUFFIX + - name: Commit and push changes + run: | + git config --global user.name "MarkenJaden" + git config --global user.email "jjsch1410@gmail.com" + git add -A + git diff-index --quiet HEAD || git commit -m "Updated mod version" + git push