Skip to content

Commit

Permalink
Added version and suffix to publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkenJaden authored Dec 20, 2023
1 parent dbd9ee9 commit d1a8ec3
Showing 1 changed file with 18 additions and 28 deletions.
46 changes: 18 additions & 28 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
Expand Down Expand Up @@ -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:
Expand All @@ -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

Expand All @@ -139,20 +135,14 @@ 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
- name: Upload to GitHub
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
Expand All @@ -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

Expand Down

0 comments on commit d1a8ec3

Please sign in to comment.