From 568e77b8be7d7d81a368c1769eaa2152500c5014 Mon Sep 17 00:00:00 2001 From: Sam Kirby <23245543+sam-kirby@users.noreply.github.com> Date: Tue, 8 Oct 2024 16:22:22 +0100 Subject: [PATCH] Update CI --- .github/workflows/ci.yml | 28 ++++++++++++++-------------- .github/workflows/release.yml | 34 ---------------------------------- build.gradle | 2 +- 3 files changed, 15 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f9a920..f8b5318 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,27 +1,20 @@ name: CI -on: - push: - branches: - - '**' - tags-ignore: - - '*.*' - pull_request: - branches: - - '**' +on: push jobs: build: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Java 8 - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: - java-version: 1.8 + java-version: 8 + distribution: temurin - name: Cache Gradle packages - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} @@ -29,7 +22,14 @@ jobs: - name: Build run: ./gradlew build - name: Package - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: SevPatches-${{ github.sha }} path: build/libs + if-no-files-found: error + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: ./build/libs/sevpatches-${{ github.ref_name }}-${{ github.run_number }}.jar + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index b21d803..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Release - -on: - release: - types: - - created - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup Java 8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Cache Gradle packages - uses: actions/cache@v1 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: ${{ runner.os }}-gradle - - name: Build - run: ./gradlew build - - name: Upload Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./build/libs/sevpatches-${{ github.event.release.tag_name }}-${{ github.run_number }}.jar - asset_name: sevpatches-${{ github.event.release.tag_name }}-${{ github.run_number }}.jar - asset_content_type: application/java-archive diff --git a/build.gradle b/build.gradle index 4015e11..6d1c00e 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'maven-publish' def buildnumber = null if (System.getenv('GITHUB_ACTIONS')) - buildnumber = System.getenv('GITHUB_WORKFLOW') == 'Release' ? System.getenv('GITHUB_RUN_NUMBER') : System.getenv('GITHUB_SHA').substring(0, 7) + buildnumber = System.getenv('GITHUB_RUN_NUMBER') def suffix = buildnumber != null ? buildnumber : 'SNAPSHOT'