Skip to content

Commit

Permalink
split-tags test
Browse files Browse the repository at this point in the history
  • Loading branch information
glowredman committed Jun 29, 2023
1 parent 47439f8 commit 9e1484c
Showing 1 changed file with 8 additions and 82 deletions.
90 changes: 8 additions & 82 deletions .github/workflows/release-tags.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,14 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Release tagged build

on:
workflow_call:
secrets:
MAVEN_USER:
required: false
MAVEN_PASSWORD:
required: false
CURSEFORGE_TOKEN:
required: false
MODRINTH_TOKEN:
required: false
inputs:
workspace:
description: 'setupCIWorkspace/setupDecompWorkspace'
required: false
default: "setupCIWorkspace"
type: string
push:
tags: [ '*' ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout mod repo
uses: actions/checkout@v3
with:
fetch-depth: 32

- name: Validate gradle wrapper checksum
uses: gradle/wrapper-validation-action@v1

- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Set up JDK 8 and 17
uses: actions/setup-java@v3
with:
java-version: |
8
17
distribution: 'zulu'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Setup the workspace
run: ./gradlew --build-cache --info --stacktrace ${{ inputs.workspace }}
permissions:
contents: write

- name: Build the mod
run: ./gradlew --build-cache --info --stacktrace build

# Continue on error in the following steps to make sure releases still get made even if one of the methods fails

- name: Delete old release if it already exists
run: gh release delete --yes "${RELEASE_VERSION}"
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Release under current tag
run: |
export "CHANGELOG_FILE=$(mktemp --suffix=.md)"
echo "CHANGELOG_FILE=${CHANGELOG_FILE}" >> $GITHUB_ENV
gh api --method POST -H "Accept: application/vnd.github+json" \
"/repos/${GITHUB_REPOSITORY}/releases/generate-notes" \
-f tag_name="${RELEASE_VERSION}" \
--jq ".body" > "${CHANGELOG_FILE}"
cat "${CHANGELOG_FILE}"
gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" ./build/libs/*.jar
shell: bash
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to Maven, Modrinth and CurseForge
run: ./gradlew --build-cache --info --stacktrace build publish
continue-on-error: true
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
if: ${{ env.MAVEN_USER != '' || env.MODRINTH_TOKEN != '' || env.CURSEFORGE_TOKEN }}
jobs:
release-tags:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@split-tags
secrets: inherit

0 comments on commit 9e1484c

Please sign in to comment.