99 lines
3.2 KiB
YAML
Raw Normal View History

2022-06-10 16:14:09 -05:00
name: 'Build Plugin'
2022-06-10 16:19:07 -05:00
on:
push:
2024-04-09 22:08:39 -04:00
branches: [ "master" ]
2024-04-19 21:41:03 -04:00
paths-ignore:
- '**/README.md'
- '.github/ISSUE_TEMPLATE/**'
- 'docs/**'
- 'images/**'
- 'manifest.json'
2022-06-10 16:19:07 -05:00
pull_request:
2024-04-09 22:08:39 -04:00
branches: [ "master" ]
2024-04-19 21:41:03 -04:00
paths-ignore:
- '**/README.md'
- '.github/ISSUE_TEMPLATE/**'
- 'docs/**'
- 'images/**'
- 'manifest.json'
2022-06-10 16:19:07 -05:00
2024-03-01 11:40:05 -05:00
permissions:
contents: write
2024-03-29 20:40:49 +01:00
packages: write
2024-03-01 11:40:05 -05:00
2022-06-10 16:19:07 -05:00
jobs:
build:
2024-04-10 07:26:03 -04:00
if: ${{ ! startsWith(github.event.head_commit.message, 'v0.') }}
2022-06-10 16:19:07 -05:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2022-06-10 16:25:44 -05:00
2022-06-10 16:19:07 -05:00
- name: Setup .NET
uses: actions/setup-dotnet@v4
2022-06-10 16:19:07 -05:00
with:
2024-03-22 23:41:58 +01:00
dotnet-version: 8.0.x
2024-05-16 05:46:23 -04:00
2022-06-10 16:19:07 -05:00
- name: Restore dependencies
2024-05-11 20:11:25 +00:00
run: dotnet restore
2022-06-10 16:25:44 -05:00
2022-06-12 16:57:15 -05:00
- name: Embed version info
run: echo "${{ github.sha }}" > ConfusedPolarBear.Plugin.IntroSkipper/Configuration/version.txt
2024-03-01 11:40:05 -05:00
- name: Retrieve commit identification
run: |
GIT_HASH=$(git rev-parse --short HEAD)
echo "GIT_HASH=${GIT_HASH}" >> $GITHUB_ENV
2022-06-10 16:19:07 -05:00
- name: Build
run: dotnet build --no-restore
2022-06-10 23:08:27 -05:00
2022-06-10 16:47:46 -05:00
- name: Upload artifact
uses: actions/upload-artifact@v4.3.3
2024-05-16 05:46:23 -04:00
if: github.event_name != 'pull_request'
2022-06-10 16:47:46 -05:00
with:
name: ConfusedPolarBear.Plugin.IntroSkipper-${{ env.GIT_HASH }}.dll
2024-03-29 20:40:49 +01:00
path: ConfusedPolarBear.Plugin.IntroSkipper/bin/Debug/net8.0/ConfusedPolarBear.Plugin.IntroSkipper.dll
2022-06-10 16:47:46 -05:00
if-no-files-found: error
2024-03-01 11:40:05 -05:00
2024-05-16 05:46:23 -04:00
- name: Upload artifact
uses: actions/upload-artifact@v4.3.3
if: github.event_name == 'pull_request'
with:
name: ConfusedPolarBear.Plugin.IntroSkipper-${{ github.head_ref }}.dll
2024-05-18 11:18:35 -04:00
path: ConfusedPolarBear.Plugin.IntroSkipper/bin/Debug/net8.0/ConfusedPolarBear.Plugin.IntroSkipper.dll
2024-05-16 05:46:23 -04:00
retention-days: 7
if-no-files-found: error
2024-03-01 11:40:05 -05:00
- name: Create archive
2024-03-02 21:05:57 -05:00
if: github.event_name != 'pull_request'
run: zip -j "intro-skipper-${{ env.GIT_HASH }}.zip" ConfusedPolarBear.Plugin.IntroSkipper/bin/Debug/net8.0/ConfusedPolarBear.Plugin.IntroSkipper.dll
2024-03-01 11:40:05 -05:00
2024-03-09 09:10:18 -05:00
- name: Generate md5
2024-03-09 09:14:39 -05:00
if: github.event_name != 'pull_request'
2024-03-29 20:40:49 +01:00
run: |
md5sum intro-skipper-${{ env.GIT_HASH }}.zip > intro-skipper-${{ env.GIT_HASH }}.md5
checksum="$(awk '{print $1}' intro-skipper-${{ env.GIT_HASH }}.md5)"
echo "CHECKSUM=$checksum" >> $GITHUB_ENV
2024-03-09 09:10:18 -05:00
- name: Check if prerelease with tag '10.9/preview' exists and delete it
2024-03-01 11:40:05 -05:00
if: github.event_name != 'pull_request'
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'
2024-03-29 20:40:49 +01:00
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."
2024-03-29 20:40:49 +01:00
env:
2024-04-19 21:41:03 -04:00
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}