replace most GitHub Actions with build functions

This commit is contained in:
Kilian von Pflugk 2024-05-27 19:33:51 +02:00
parent b06ab6e41f
commit 977913ffc8
2 changed files with 21 additions and 50 deletions

View File

@ -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 }}

View File

@ -44,11 +44,7 @@ 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: |
@ -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 }}