add pipeline
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
name: Build and publish
|
||||
|
||||
env:
|
||||
CURSEFORGE_PROJECT_ID: "1668190"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ailments-${{ github.workflow }}-${{ github.event.release.tag_name || github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name != 'release' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Test and build Java 17 JAR
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
outputs:
|
||||
jar_name: ${{ steps.artifact.outputs.jar_name }}
|
||||
minecraft_version: ${{ steps.artifact.outputs.minecraft_version }}
|
||||
mod_version: ${{ steps.artifact.outputs.mod_version }}
|
||||
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Java 17
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: "17"
|
||||
|
||||
- name: Set up and validate Gradle
|
||||
uses: gradle/actions/setup-gradle@v6
|
||||
|
||||
- name: Make Gradle wrapper executable
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Run tests and build the reobfuscated JAR
|
||||
run: ./gradlew clean test build --no-daemon --stacktrace
|
||||
|
||||
- name: Verify version and release artifact
|
||||
id: artifact
|
||||
env:
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
run: bash .github/scripts/verify-release-artifact.sh
|
||||
|
||||
- name: Create SHA-256 checksum
|
||||
env:
|
||||
JAR_PATH: ${{ steps.artifact.outputs.jar_path }}
|
||||
run: |
|
||||
cd "$(dirname "$JAR_PATH")"
|
||||
sha256sum "$(basename "$JAR_PATH")" > "$(basename "$JAR_PATH").sha256"
|
||||
|
||||
- name: Upload workflow artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ascend-ailments-${{ github.run_id }}
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
path: |
|
||||
${{ steps.artifact.outputs.jar_path }}
|
||||
${{ steps.artifact.outputs.jar_path }}.sha256
|
||||
|
||||
publish:
|
||||
name: Publish GitHub and CurseForge release
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Check out released source
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Download verified release artifact
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: ascend-ailments-${{ github.run_id }}
|
||||
path: release-artifacts
|
||||
|
||||
- name: Prepare release metadata
|
||||
id: release
|
||||
env:
|
||||
RELEASE_PRERELEASE: ${{ github.event.release.prerelease }}
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
run: bash .github/scripts/prepare-release-metadata.sh
|
||||
|
||||
- name: Attach JAR and checksum to the GitHub release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
run: gh release upload "$RELEASE_TAG" "release-artifacts/${{ needs.build.outputs.jar_name }}" "release-artifacts/${{ needs.build.outputs.jar_name }}.sha256" --clobber
|
||||
|
||||
- name: Upload JAR to CurseForge
|
||||
env:
|
||||
CHANGELOG_FILE: release-artifacts/changelog.md
|
||||
CURSEFORGE_API_TOKEN: ${{ secrets.CURSEFORGE_API_TOKEN }}
|
||||
DISPLAY_NAME: ${{ steps.release.outputs.display_name }}
|
||||
JAR_PATH: release-artifacts/${{ needs.build.outputs.jar_name }}
|
||||
MINECRAFT_VERSION: ${{ needs.build.outputs.minecraft_version }}
|
||||
RELEASE_TYPE: ${{ steps.release.outputs.release_type }}
|
||||
run: bash .github/scripts/publish-curseforge.sh
|
||||
Reference in New Issue
Block a user