Deployment (J17) #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deployment (J17) | |
on: [workflow_dispatch] | |
jobs: | |
build-and-deploy: | |
env: | |
BRANCH_PREFIX: $(cat gradle.properties | grep mod_version | cut -d'+' -f2) | |
strategy: | |
matrix: | |
java: [17] | |
runs-on: ubuntu-latest | |
steps: | |
- name: check environment variables | |
run: env | |
- name: checkout repository | |
uses: actions/checkout@v3 | |
- name: validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: setup jdk ${{ matrix.java }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'microsoft' | |
- name: make gradle wrapper executable | |
run: chmod +x ./gradlew | |
- name: build | |
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}' | |
run: ./gradlew build | |
- name: capture build artifacts | |
if: | | |
${{ matrix.java == '17' }} | |
github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Artifacts | |
path: build/libs/ | |
- name: get mod version and loader | |
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}' | |
id: mod_version | |
run: | | |
loader_val=$(grep "loader" gradle.properties | cut -d'=' -f2 | tr -d '\n') | |
mod_version_val=$(grep "mod_version" gradle.properties | cut -d'=' -f2 | tr -d '\n') | |
echo "mod_version=$mod_version_val-$loader_val" >> $GITHUB_OUTPUT | |
echo "commitish=$mod_version_val/$loader_val" >> $GITHUB_OUTPUT | |
- name: get minecraft version | |
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}' | |
id: minecraft_version | |
run: | | |
minecraft_version_val=$(grep "mod_version" gradle.properties | cut -d'+' -f2 | cut -d'-' -f1 | tr -d '\n') | |
echo "minecraft_version=$minecraft_version_val" >> $GITHUB_OUTPUT | |
- name: deploy with mc-publish | |
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}' | |
uses: Kir-Antipov/[email protected] | |
with: | |
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} | |
modrinth-token: "${{ secrets.MODRINTH_TOKEN }}" | |
github-tag: ${{ steps.mod_version.outputs.mod_version }} | |
github-token: ${{ secrets.REPOSITORY_TOKEN }} | |
github-commitish: ${{ steps.commitish.outputs.commitish }} | |
version: "${{ steps.outputs.mod_version }}" | |
changelog-file: CHANGELOG.md | |
game-versions: "${{ steps.minecraft_version.outputs.minecraft_version }}" | |
java: "${{ matrix.java }}" |