Skip to content

Commit

Permalink
ci: Add publish-api-release task
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Jun 1, 2024
1 parent e5b9bbd commit 4de4c89
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
67 changes: 67 additions & 0 deletions .github/workflows/publish-api-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: publish-release
on:
workflow_dispatch:
inputs:
bump:
description: 'The bump in version for this release'
required: true
type: choice
default: patch
options:
- patch

jobs:
create-release:
runs-on: ubuntu-latest
outputs:
ref: v${{ steps.bump-version.outputs.version }}
version: ${{ steps.bump-version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Extracting version from properties
shell: bash
run: echo "version=$(cat kuma/gradle.properties | grep -w "\bversion" | cut -d= -f2)" >> $GITHUB_OUTPUT
id: extract-version
- name: Bumping version
uses: TwelveIterationMods/bump-version@v1
with:
version: ${{ steps.extract-version.outputs.version }}
bump: ${{ inputs.bump }}
id: bump-version
- name: Updating version properties
run: |
sed -i "s/^\s*version\s*=.*/version = ${{ steps.bump-version.outputs.version }}/g" kuma/gradle.properties
git config user.name "GitHub Actions"
git config user.email "<>"
git commit -am "Set version to ${{ steps.bump-version.outputs.version }}"
git push origin ${BRANCH_NAME}
git tag -a "v${{ steps.bump-version.outputs.version }}" -m "Release ${{ steps.bump-version.outputs.version }}"
git push origin "v${{ steps.bump-version.outputs.version }}"
shell: bash
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
publish-release:
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
matrix:
loader: [ common, fabric, forge, neoforge ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ needs.create-release.outputs.ref }}
- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup JDK
uses: actions/setup-java@v3
with:
java-version: 21
distribution: temurin
- name: Make gradle wrapper executable
run: chmod +x ./gradlew
- name: Publish API
run: ./gradlew :kuma-api:${{ matrix.loader }}:publish '-Pversion=${{needs.create-release.outputs.version}}' '-PtwelveIterationsNexusUsername=${{ secrets.NEXUS_USER }}' '-PtwelveIterationsNexusPassword=${{ secrets.NEXUS_PASSWORD }}'
needs: create-release
2 changes: 1 addition & 1 deletion kuma-api/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod_name = KumaAPI
mod_author = BlayTheNinth
credits = BlayTheNinth
description = Universal Key Modifier API (Shift, CTRL, etc.)
version = 20.6.1
version = 20.6.0
group = net.blay09.mods
homepage=https://mods.twelveiterations.com/mc/kuma
sources=https://github.com/TwelveIterationMods/Kuma
Expand Down

0 comments on commit 4de4c89

Please sign in to comment.