mirror of
https://github.com/LegacyModdingMC/UniMixins.git
synced 2026-11-19 11:59:38 +00:00
75 lines
2.6 KiB
YAML
75 lines
2.6 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:
|
|
# - '*'
|
|
workflow_dispatch
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Set release version
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up JDK 1.8
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: 8
|
|
- 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 -PnoAltMixin
|
|
- name: Copy artifacts to a single directory
|
|
run: |
|
|
mkdir build/tmp/ci -p
|
|
cp module-*/build/libs/* build/tmp/ci
|
|
rm build/tmp/ci/*-sources.jar
|
|
rm build/tmp/ci/*-dev.jar
|
|
rm build/tmp/ci/*-common-*.jar
|
|
- 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/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 -PdebugPublish)
|
|
(cd publish; ./gradlew publishCurseforge -PdebugPublish)
|
|
env:
|
|
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
|
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
|
|
# - name: Delete last draft release
|
|
# run: |
|
|
# gh api -X DELETE "/repos/${GITHUB_REPOSITORY}/releases/$(cat /tmp/draft_id.txt)"
|
|
# env:
|
|
# GH_TOKEN: ${{ github.token }}
|