Skip to content

Commit

Permalink
Update publish_project.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
iouter authored Jan 2, 2024
1 parent e4dc5c3 commit 643aaf1
Showing 1 changed file with 33 additions and 37 deletions.
70 changes: 33 additions & 37 deletions .github/workflows/publish_project.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,54 @@
# Publishes the project to GitHub Releases, CurseForge, and Modrinth
# Publishes built jars to distribution platforms
name: Publish Project

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # any SemVer tag, e.g. v1.2.3
on: workflow_dispatch

env:
# link to the changelog with a format code for the version
CHANGELOG_LOCATION: "Changelog is available [here](https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }})"
CHANGELOG_LOCATION: "Changelog is available [here](https://github.com/${{github.repository}}/releases/tag/${{github.ref_name}})"
# type of release
RELEASE_TYPE: 'beta'

concurrency:
group: publish-${{ github.head_ref || github.ref }}
cancel-in-progress: true
RELEASE_TYPE: "beta"

jobs:
publish:
name: Publish
Publish:
runs-on: ubuntu-latest

permissions:
permissions:
contents: write # needed to create GitHub releases

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Build
uses: ./.github/actions/build_setup

uses: actions/checkout@v3

- name: Check for Duplicate Tags
run: |
if git rev-parse -q --verify "refs/tags/${{ github.ref }}" >/dev/null; then
echo "Tag already exists. A version bump is required."
exit 1
fi
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Build Project
run: ./gradlew build --warning-mode all --build-cache

uses: gradle/gradle-build-action@v2
with:
arguments: 'build --build-cache --daemon' # use the daemon here so the rest of the process is faster
generate-job-summary: false
gradle-home-cache-includes: |
caches
jdks
notifications
wrapper
- name: Publish to GitHub
uses: softprops/action-gh-release@v1
with:
files: "build/libs/*.jar"
generate_release_notes: true
fail_on_unmatched_files: true

- name: Publish to Curseforge
env:
CURSEFORGE_API_KEY: "${{ secrets.CURSEFORGE_API_KEY }}"
CURSEFORGE_PROJECT_ID: "${{ secrets.CURSEFORGE_PROJECT_ID }}"
CHANGELOG_LOCATION: "${{ env.CHANGELOG_LOCATION }}"
RELEASE_TYPE: "${{ env.RELEASE_TYPE }}"
run: ./gradlew curseforge --warning-mode all --build-cache

- name: Publish to Modrinth
env:
MODRINTH_API_KEY: "${{ secrets.MODRINTH_API_KEY }}"
MODRINTH_PROJECT_ID: "${{ secrets.MODRINTH_PROJECT_ID }}"
CHANGELOG_LOCATION: "${{ env.CHANGELOG_LOCATION }}"
RELEASE_TYPE: "${{ env.RELEASE_TYPE }}"
run: ./gradlew modrinth --warning-mode all --build-cache
tag_name: tags
name: names

0 comments on commit 643aaf1

Please sign in to comment.