Merge branch 'main' of https://github.com/Wet-Boys/LethalEmotesAPI #84
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release tagged build | |
on: | |
push: | |
tags: [ '*' ] | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
USE_STUBBED_LIBS: 1 | |
RELEASE_VERSION: ${{ github.ref_name }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
# - name: Exit if not on main branch | |
# if: endsWith(github.ref, 'main') == false | |
# run: exit -1 | |
- name: Get prior latest release on GitHub | |
run: | | |
export "LATEST_RELEASE_TAG=$(gh release view latest | tail -1 | grep -Go "tag/[0-9]\.[0-9]\.[0-9]")" | |
echo "${LATEST_RELEASE_TAG}" | grep -Go "[0-9]\.[0-9]\.[0-9]" || exit -1 | |
echo "LATEST_RELEASE_TAG=${LATEST_RELEASE_TAG}" >> "$GITHUB_ENV" | |
shell: bash | |
continue-on-error: true | |
- name: Validate changelog has changed | |
if: ${{ env.LATEST_RELEASE_TAG != '' }} | |
run: git diff --quiet tags/${LATEST_RELEASE_TAG} HEAD -- CHANGELOG.md || exit -1 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Grant execute permissions for build script | |
run: chmod +x build.sh | |
- name: Validate Thunderstore package and version | |
run: ./build.sh --configuration=Release --target=ThunderstoreChecklist | |
- name: Build Thunderstore Package | |
run: ./build.sh --target=BuildThunderstore | |
- name: Build NuGet Package | |
run: ./build.sh --configuration=Release --target=BuildNuGet | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: lethal-emotes-api | |
path: CustomEmotesAPI/bin/Debug/netstandard2.1/upload/ | |
retention-days: 15 | |
- name: Get NuGet Package path | |
run: | | |
for fn in CustomEmotesAPI/bin/Release/netstandard2.1/artifacts/*.nupkg; do echo "NUGET_PKG_PATH=${fn}" >> "$GITHUB_ENV"; done; | |
shell: bash | |
continue-on-error: true | |
- name: Push NuGet Package | |
run: dotnet nuget push "${NUGET_PKG_PATH}" --api-key $NUGET_API_TOKEN --source https://api.nuget.org/v3/index.json | |
env: | |
NUGET_API_TOKEN: ${{ secrets.NUGET_LETHAL_COMPNAY_KEY }} | |
- name: Delete old release if it already exists | |
run: gh release delete --yes "${RELEASE_VERSION}" | |
continue-on-error: true | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release under current tag | |
run: | | |
export "CHANGELOG_FILE=$(mktemp --suffix=.md)" | |
echo "CHANGELOG_FILE=${CHANGELOG_FILE}" >> $GITHUB_ENV | |
gh api --method POST -H "Accept: application/vnd.github+json" \ | |
"/repos/${GITHUB_REPOSITORY}/releases/generate-notes" \ | |
-f tag_name="${RELEASE_VERSION}" \ | |
--jq ".body" > "${CHANGELOG_FILE}" | |
cat "${CHANGELOG_FILE}" | |
gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" CustomEmotesAPI/bin/Debug/netstandard2.1/upload/*.zip | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.RELEASES_TOKEN }} | |
- name: Get upload file path | |
run: | | |
for fn in CustomEmotesAPI/bin/Debug/netstandard2.1/upload/*.zip; do echo "THUNDERSTORE_PKG_PATH=${fn}" >> "$GITHUB_ENV"; done; | |
shell: bash | |
- name: Upload Thunderstore Package | |
uses: GreenTF/upload-thunderstore-package@v4.1 | |
with: | |
namespace: Gemumoddo | |
name: LethalEmotesAPI | |
description: Empty | |
version: ${{ github.ref_name }} | |
community: lethal-company | |
token: ${{ secrets.THUNDERSTORE_TOKEN }} | |
repo: thunderstore.io | |
categories: | | |
mods | |
libraries | |
emotes | |
file: ${{ env.THUNDERSTORE_PKG_PATH }} |