From 977913ffc8d763d27f0a50abc3772c92c7a83546 Mon Sep 17 00:00:00 2001 From: Kilian von Pflugk Date: Mon, 27 May 2024 19:33:51 +0200 Subject: [PATCH] replace most GitHub Actions with build functions --- .github/workflows/build.yml | 43 +++++++++++++---------------------- .github/workflows/release.yml | 28 ++++------------------- 2 files changed, 21 insertions(+), 50 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 160bc4f..9ba7d19 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,12 +68,8 @@ jobs: if-no-files-found: error - name: Create archive - uses: vimtor/action-zip@v1.2 if: github.event_name != 'pull_request' - with: - files: | - ConfusedPolarBear.Plugin.IntroSkipper/bin/Debug/net8.0/ConfusedPolarBear.Plugin.IntroSkipper.dll - dest: intro-skipper-${{ env.GIT_HASH }}.zip + run: zip -j "intro-skipper-${{ env.GIT_HASH }}.zip" ConfusedPolarBear.Plugin.IntroSkipper/bin/Debug/net8.0/ConfusedPolarBear.Plugin.IntroSkipper.dll - name: Generate md5 if: github.event_name != 'pull_request' @@ -82,28 +78,21 @@ jobs: checksum="$(awk '{print $1}' intro-skipper-${{ env.GIT_HASH }}.md5)" echo "CHECKSUM=$checksum" >> $GITHUB_ENV - - name: Publish prerelease - uses: 8bitDream/action-github-releases@v1.0.0 + - name: Check if prerelease with tag '10.9/preview' exists and delete it if: github.event_name != 'pull_request' - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: 10.9/preview - prerelease: true - title: intro-skipper-${{ env.GIT_HASH }} - files: | - intro-skipper-${{ env.GIT_HASH }}.zip - - - name: Publish prerelease notes - uses: softprops/action-gh-release@v2.0.5 - if: github.event_name != 'pull_request' - with: - tag_name: 10.9/preview - name: intro-skipper-${{ env.GIT_HASH }} - append_body: true - body: | - --- - checksum: ${{ env.CHECKSUM }} - draft: false - prerelease: true + run: | + if gh release view 10.9/preview --json id 2>/dev/null; then + release_id=$(gh release view 10.9/preview --json id -q ".id") + echo "Deleting existing prerelease with id: $release_id" + gh release delete 10.9/preview -y + else + echo "No existing prerelease with tag '10.9/preview' found." + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create new prerelease with tag '10.9/preview' + if: github.event_name != 'pull_request' + run: gh release create 10.9/preview "intro-skipper-${{ env.GIT_HASH }}.zip" --prerelease --title "intro-skipper-${{ env.GIT_HASH }}" --notes "This is a prerelease version." env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c3f07b5..1029e23 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,12 +44,8 @@ jobs: if-no-files-found: error - name: Create archive - uses: vimtor/action-zip@v1.2 - with: - files: | - ConfusedPolarBear.Plugin.IntroSkipper/bin/Debug/net8.0/ConfusedPolarBear.Plugin.IntroSkipper.dll - dest: intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip - + run: zip -j "intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip" ConfusedPolarBear.Plugin.IntroSkipper/bin/Debug/net8.0/ConfusedPolarBear.Plugin.IntroSkipper.dll + - name: Generate manifest keys run: | sourceUrl="https://github.com/${{ github.repository }}/releases/download/10.9/v${{ env.NEW_FILE_VERSION }}/intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip" @@ -60,23 +56,9 @@ jobs: timestamp="$(date +%FT%TZ)" echo "TIMESTAMP=$timestamp" >> $GITHUB_ENV - - name: Publish release - uses: 8bitDream/action-github-releases@v1.0.0 - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: 10.9/v${{ env.NEW_FILE_VERSION }} - prerelease: false - title: v${{ env.NEW_FILE_VERSION }} - files: | - intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip - - - name: Publish release notes - uses: softprops/action-gh-release@v2.0.5 - with: - tag_name: 10.9/v${{ env.NEW_FILE_VERSION }} - name: v${{ env.NEW_FILE_VERSION }} - draft: false - prerelease: false + - name: Create new release with tag + if: github.event_name != 'pull_request' + run: gh release create "10.9/v${{ env.NEW_FILE_VERSION }}" "intro-skipper-v${{ env.NEW_FILE_VERSION }}.zip" --title "v${{ env.NEW_FILE_VERSION }}" --latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}