mirror of
https://github.com/LegacyModdingMC/UniMixins.git
synced 2026-10-26 14:34:00 +00:00
* Bump mixin * Update github actions --------- Co-authored-by: Raven Szewczyk <git@eigenraven.me>
101 lines
3.7 KiB
YAML
101 lines
3.7 KiB
YAML
# This workflow will build the project and publish a release using the changelog
|
|
# in the last draft release. The draft is deleted after the task is finished.
|
|
|
|
# Usage:
|
|
# 1. Create a draft release. Set the description and the tag (everything else
|
|
# will be ignored)
|
|
# 2. Push a tag with the same name
|
|
|
|
name: Release tagged build
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
- name: Set release version
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up JDK 1.8
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: 8
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@v4
|
|
with:
|
|
build-scan-publish: true
|
|
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
|
|
build-scan-terms-of-use-agree: "yes"
|
|
validate-wrappers: true
|
|
- name: Grant execute permission for gradlew
|
|
run: chmod +x gradlew
|
|
- name: Set up Gradle build
|
|
run: ./gradlew setupCIWorkspace
|
|
- name: Build with Gradle
|
|
run: ./gradlew build
|
|
- name: Copy artifacts to a single directory
|
|
run: |
|
|
mkdir build/tmp/ci -p
|
|
mkdir build/tmp/ci-dev -p
|
|
mkdir build/tmp/ci-sources -p
|
|
cp module-*/build/libs/* build/tmp/ci
|
|
mv build/tmp/ci/*-all-*-dev.jar build/tmp/ci-dev
|
|
mv build/tmp/ci/*-compat-*-dev.jar build/tmp/ci-dev
|
|
rm build/tmp/ci/*-dev.jar
|
|
mv build/tmp/ci-dev/* build/tmp/ci
|
|
rm build/tmp/ci/*-common-*.jar
|
|
mv build/tmp/ci/*-sources.jar build/tmp/ci-sources
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Package
|
|
path: build/tmp/ci
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Package-sources
|
|
path: build/tmp/ci-sources
|
|
- name: Read changelog from last draft release
|
|
run: |
|
|
gh api "/repos/${GITHUB_REPOSITORY}/releases?per_page=1" \
|
|
| jq ".[0]" > /tmp/last-release.json
|
|
[ $(cat /tmp/last-release.json | jq '.draft' -r) == true ] || (echo "Error: Last release is not a draft" && false)
|
|
DRAFT_TAG=$(cat /tmp/last-release.json | jq '.tag_name' -r)
|
|
[ $DRAFT_TAG == $RELEASE_VERSION ] || (echo "Error: Last draft's tag does not match pushed tag" && false)
|
|
cat /tmp/last-release.json | jq '.body' -r > /tmp/changelog.md
|
|
[ $(cat /tmp/changelog.md | wc -w) -gt 0 ] || (echo "Error: Draft is missing a changelog" && false)
|
|
cat /tmp/last-release.json | jq '.id' > /tmp/draft_id.txt
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: build/tmp/ci/*.jar
|
|
body_path: /tmp/changelog.md
|
|
- name: Modrinth and CurseForge release
|
|
run: |
|
|
cp /tmp/changelog.md publish/changelog.md
|
|
(cd publish; ./gradlew publishModrinth --stacktrace) || true
|
|
(cd publish; ./gradlew publishCurseforge --stacktrace)
|
|
env:
|
|
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
|
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
|
|
- name: Publish to GTNH maven
|
|
run: ./gradlew publish
|
|
env:
|
|
MAVEN_URL: ${{ secrets.MAVEN_URL }}
|
|
MAVEN_USER: ${{ secrets.MAVEN_USERNAME }}
|
|
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
|
- name: Delete last draft release
|
|
run: |
|
|
gh api -X DELETE "/repos/${GITHUB_REPOSITORY}/releases/$(cat /tmp/draft_id.txt)"
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|