ESO Addon Release #35
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: ESO Addon Release | |
# Auslöser: Bei einem Pull Request auf die master-Branch von development oder manueller dispatch | |
on: | |
pull_request: | |
branches: | |
- master | |
types: | |
- closed | |
workflow_dispatch: | |
jobs: | |
build: | |
if: (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master' && github.event.pull_request.head.ref == 'development') || (github.event_name == 'workflow_dispatch') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
path: 'barnysCCTracker' | |
- name: Set Test only | |
id: test_only | |
run: | | |
echo "TEST_ONLY=true" >> $GITHUB_ENV | |
- name: Extract API Version and Addon Version | |
id: version_info | |
run: | | |
APIVersion=$(grep -Po '(?<=## APIVersion: )\d+' barnysCCTracker/barnysCCTracker.txt) | |
AddonVersion=$(grep -Po '(?<=## Version: )[\d.]+' barnysCCTracker/barnysCCTracker.txt) | |
echo "API_VERSION=$APIVersion" >> $GITHUB_ENV | |
echo "ADDON_VERSION=$AddonVersion" >> $GITHUB_ENV | |
- name: Get Compatible Patch ID | |
id: get_patch_id | |
run: | | |
# Hole die aktuelle Patchnummer | |
PatchVersion=$(grep -Po '(?<=## APIVersion: )\d+' barnysCCTracker/barnysCCTracker.txt) | |
# Anfrage an die ESOUI API, um die ID für die Patch-Version zu erhalten | |
PatchID=$(curl -s -H "x-api-token: ${{ secrets.ESOUI_API_TOKEN }}" "https://api.esoui.com/addons/compatible.json" | jq -r ".[] | select(.interface == \"$PatchVersion\") | .id") | |
echo "PATCH_ID=$PatchID" >> $GITHUB_ENV | |
- name: Extract Changelog | |
id: changelog | |
run: | | |
Changelog=$(cat barnysCCTracker/Changelog.txt) | |
echo "CHANGELOG<<EOF" >> $GITHUB_ENV | |
echo "$Changelog" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
#- name: Extract Addon Description | |
# id: description | |
# run: | | |
# Description=$(cat barnysCCTracker/README.md) | |
# echo "DESCRIPTION<<EOF" >> $GITHUB_ENV | |
# echo "$Description" >> $GITHUB_ENV | |
# echo "EOF" >> $GITHUB_ENV | |
- name: Zip Addon Files (excluding .gitattributes) | |
run: 7z a ./barnysCCTracker/barnysCCTracker.zip ./barnysCCTracker/* -xr!*.git* | |
- name: Create GitHub Release | |
if: env.TEST_ONLY == 'false' # Nur wenn TEST_ONLY false ist | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.CREATE_RELEASE_TOKEN }} | |
with: | |
tag_name: ${{ env.ADDON_VERSION }} | |
name: Release ${{ env.ADDON_VERSION }} | |
body: ${{ env.CHANGELOG }} | |
draft: false | |
prerelease: false | |
- name: Upload Addon to ESOUI with PowerShell | |
shell: pwsh | |
run: | | |
$baseDir = Get-Location | |
$changelogPath = "$baseDir/barnysCCTracker/Changelog.txt" | |
$readmePath = "$baseDir/barnysCCTracker/README.md" | |
Write-Host "Changelog Path: $changelogPath" # Debugging-Ausgabe | |
Write-Host "Readme Path: $readmePath" # Debugging-Ausgabe | |
./barnysCCTracker/.github/scripts/upload_to_esoui.ps1 ` | |
-ApiToken "${{ secrets.ESOUI_API_TOKEN }}" ` | |
-AddonId 3971 ` | |
-Title "barny's CC Tracker" ` | |
-Version "${{ env.ADDON_VERSION }}" ` | |
-FilePath "./barnysCCTracker/barnysCCTracker.zip" ` | |
-ChangelogFilePath "$changelogPath" ` | |
-Compatible "${{ env.PATCH_ID }}" ` | |
-ReadmeFilePath "$readmePath" ` | |
-TestOnly "${{ env.TEST_ONLY }}" |