From 05489dee3109370d123d9af26a8c37c5cbbfb6fb Mon Sep 17 00:00:00 2001 From: Telan <13066272+TheElan@users.noreply.github.com> Date: Sun, 21 Nov 2021 21:20:43 +0200 Subject: [PATCH] ci: make "latest" releases on each push to master and remove "latest" releases from tags --- .github/workflows/pull-request.yml | 2 - .github/workflows/release-latest.yml | 44 ++++++++++++ .github/workflows/release-packages-latest.yml | 72 +++++++++++++++++++ ...packages.yml => release-packages-tags.yml} | 15 ++-- .../{release.yml => release-tags.yml} | 9 --- 5 files changed, 120 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/release-latest.yml create mode 100644 .github/workflows/release-packages-latest.yml rename .github/workflows/{release-packages.yml => release-packages-tags.yml} (82%) rename .github/workflows/{release.yml => release-tags.yml} (81%) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 141530d..d62a2f5 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -6,8 +6,6 @@ name: Build and test on: pull_request: branches: [ master, main ] - push: - branches: [ master, main ] jobs: build: diff --git a/.github/workflows/release-latest.yml b/.github/workflows/release-latest.yml new file mode 100644 index 0000000..5ecccc0 --- /dev/null +++ b/.github/workflows/release-latest.yml @@ -0,0 +1,44 @@ +# 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 latest build + +on: + push: + branches: [ master, main ] + +jobs: + build-and-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup the workspace + run: ./gradlew setupCIWorkspace + + - name: Build the mod + run: ./gradlew build + + - name: Update latest tag + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: false + title: "Latest build" + files: build/libs/*.jar diff --git a/.github/workflows/release-packages-latest.yml b/.github/workflows/release-packages-latest.yml new file mode 100644 index 0000000..1f1b162 --- /dev/null +++ b/.github/workflows/release-packages-latest.yml @@ -0,0 +1,72 @@ +# 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 latest starter and migration packages + +on: + push: + branches: [ master, main ] + +jobs: + zip-and-release-packages: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Prepare release folder + run: | + mkdir packages + + - name: Zip starter + uses: montudor/action-zip@v1 + with: + args: > + zip -r packages/starter.zip . \ + \ + -x "*.git/*" \ + \ + -x ".github/scripts/update-version.sh" \ + -x ".github/workflows/buildscript-maintenance.yml" \ + -x ".github/workflows/release-packages-latest.yml" \ + -x ".github/workflows/release-packages-tags.yml" \ + \ + -x "*docs/*" \ + -x "README.md" \ + -x "LICENSE" \ + \ + -x "starter.zip" \ + -x "migration.zip" + + - name: Zip migration + uses: montudor/action-zip@v1 + with: + args: > + zip -r packages/migration.zip . \ + \ + -x "*.git/*" \ + \ + -x ".github/scripts/update-version.sh" \ + -x ".github/workflows/buildscript-maintenance.yml" \ + -x ".github/workflows/release-packages-latest.yml" \ + -x ".github/workflows/release-packages-tags.yml" \ + \ + -x "*docs/*" \ + -x "*src/*" \ + -x "LICENSE" \ + -x "README.md" \ + \ + -x "starter.zip" \ + -x "migration.zip" + + - name: Update latest tag + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest-packages" + prerelease: false + title: "Latest starter and migration packages" + files: packages/* diff --git a/.github/workflows/release-packages.yml b/.github/workflows/release-packages-tags.yml similarity index 82% rename from .github/workflows/release-packages.yml rename to .github/workflows/release-packages-tags.yml index d117fc5..23e3b87 100644 --- a/.github/workflows/release-packages.yml +++ b/.github/workflows/release-packages-tags.yml @@ -32,7 +32,8 @@ jobs: \ -x ".github/scripts/update-version.sh" \ -x ".github/workflows/buildscript-maintenance.yml" \ - -x ".github/workflows/release-packages.yml" \ + -x ".github/workflows/release-packages-latest.yml" \ + -x ".github/workflows/release-packages-tags.yml" \ \ -x "*docs/*" \ -x "README.md" \ @@ -51,7 +52,8 @@ jobs: \ -x ".github/scripts/update-version.sh" \ -x ".github/workflows/buildscript-maintenance.yml" \ - -x ".github/workflows/release-packages.yml" \ + -x ".github/workflows/release-packages-latest.yml" \ + -x ".github/workflows/release-packages-tags.yml" \ \ -x "*docs/*" \ -x "*src/*" \ @@ -69,12 +71,3 @@ jobs: prerelease: false title: "${{ env.RELEASE_VERSION }} starter and migration packages" files: packages/* - - - name: Update latest tag - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest-packages" - prerelease: false - title: "Latest starter and migration packages" - files: packages/* diff --git a/.github/workflows/release.yml b/.github/workflows/release-tags.yml similarity index 81% rename from .github/workflows/release.yml rename to .github/workflows/release-tags.yml index 05af834..3bc35d2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release-tags.yml @@ -43,12 +43,3 @@ jobs: prerelease: false title: "${{ env.RELEASE_VERSION }}" files: build/libs/*.jar - - - name: Update latest tag - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" - prerelease: false - title: "Latest" - files: build/libs/*.jar