From 7ac419cae6db2f54e000193338eaa976e4cf68d1 Mon Sep 17 00:00:00 2001 From: Niklas Widmann Date: Fri, 25 Aug 2023 13:18:44 +0200 Subject: [PATCH] update release workflow (#62) --- .github/workflows/release.yml | 52 +++++++++++++---------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6e98118..175c4af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,58 +7,44 @@ jobs: build: name: Release runs-on: ubuntu-latest + permissions: + contents: write + packages: write steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 + - uses: actions/checkout@v3 - - name: Set up JDK - uses: actions/setup-java@v1 + - uses: actions/setup-java@v3 with: java-version: 17 + distribution: temurin - - run: chmod +x ./gradlew - - - name: Cache Gradle packages - uses: actions/cache@v1 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: ${{ runner.os }}-gradle + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 - name: Update mod version uses: christian-draeger/write-properties@1.0.1 with: path: 'gradle.properties' - property: 'version' + property: 'mod_version' value: ${{ github.event.release.tag_name }} - - name: Build + - name: Build and upload + uses: gradle/gradle-build-action@v2 + with: + arguments: build curseforge modrinth publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} CHANGELOG: ${{ github.event.release.body }} - run: ./gradlew build curseforge modrinth + CI: true - name: Upload forge jar to release - if: ${{ github.event_name == 'release' }} - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: svenstaro/upload-release-action@v2 with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: Forge/build/libs/skygrid-forge-${{ github.event.release.tag_name }}.jar - asset_name: skygrid-forge-${{ github.event.release.tag_name }}.jar - asset_content_type: application/java-archive + file: forge/build/libs/skygrid-forge-${{ github.event.release.tag_name }}.jar - name: Upload fabric jar to release - if: ${{ github.event_name == 'release' }} - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: svenstaro/upload-release-action@v2 with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: Fabric/build/libs/skygrid-fabric-${{ github.event.release.tag_name }}.jar - asset_name: skygrid-fabric-${{ github.event.release.tag_name }}.jar - asset_content_type: application/java-archive + file: fabric/build/libs/skygrid-fabric-${{ github.event.release.tag_name }}.jar \ No newline at end of file