Skip to content

Commit

Permalink
Update test_release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
PassiveModding committed Nov 16, 2024
1 parent c184b26 commit e829a36
Showing 1 changed file with 44 additions and 12 deletions.
56 changes: 44 additions & 12 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ concurrency:
on:
push:
tags:
- "testing_*"
- "testing_v*"
- "testing_*_v*"

# So we can use the GitHub API to create releases with the run token.
permissions:
Expand Down Expand Up @@ -37,20 +38,53 @@ jobs:
with:
dotnet-version: 8.0.x

- name: Extract version and custom path
run: |
tag=${{ github.ref_name }}
# Check if tag matches the new pattern (testing_{custom_path}_v{version})
if [[ $tag =~ ^testing_(.+)_v(.+)$ ]]; then
custom_path="${BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
download_path="${BASH_REMATCH[1]}"
# Check if tag matches the original pattern (testing_v{version})
elif [[ $tag =~ ^testing_v(.+)$ ]]; then
custom_path="latest"
version="${BASH_REMATCH[1]}"
download_path=""
else
echo "Tag format not recognized"
exit 1
fi
echo "CUSTOM_PATH=$custom_path" >> $GITHUB_ENV
echo "VERSION=$version" >> $GITHUB_ENV
echo "DOWNLOAD_PATH=$download_path" >> $GITHUB_ENV
echo "Custom Path: $custom_path"
echo "Download Path: $download_path"
echo "Version: $version"
- name: Download Dalamud Library
run: |
wget https://goatcorp.github.io/dalamud-distrib/latest.zip -O /tmp/dalamud.zip
download_url="https://goatcorp.github.io/dalamud-distrib"
if [ ! -z "${{ env.DOWNLOAD_PATH }}" ]; then
download_url="$download_url/${{ env.DOWNLOAD_PATH }}"
fi
download_url="$download_url/latest.zip"
echo "Downloading from: $download_url"
wget $download_url -O /tmp/dalamud.zip
unzip /tmp/dalamud.zip -d /tmp/dalamud
- name: Restore Dependencies
run: dotnet restore

- name: Build plugin in release mode
run: |
version=$(echo ${{ github.ref_name }} | sed 's/testing_v//')
echo "Version: $version"
dotnet build -c Release --no-restore --nologo -o ./bin/Release -p:Version=$version -p:AssemblyVersion=$version -p:FileVersion=$version
dotnet build -c Release --no-restore --nologo -o ./bin/Release \
-p:Version=${{ env.VERSION }} \
-p:AssemblyVersion=${{ env.VERSION }} \
-p:FileVersion=${{ env.VERSION }}
- name: Generate Checksums
working-directory: Meddle/Meddle.Plugin/bin/Release/Meddle.Plugin
run: |
Expand Down Expand Up @@ -79,16 +113,14 @@ jobs:
- name: Update repo.json
run: |
cd ../../
release_version=$(echo "${{ github.ref_name }}" | sed 's/^testing_v//')
echo "Release Version: $release_version"
repo_url="$(echo "${{ github.server_url }}/${{ github.repository }}" | sed 's/#/\\#/g')"
echo "Repo URL: $repo_url"
# Update the JSON file using jq
jq --arg release_version "$release_version" \
jq --arg version "${{ env.VERSION }}" \
--arg repo_url "$repo_url/releases/download/${{ github.ref_name }}/latest.zip" \
'.[0].TestingAssemblyVersion = $release_version |
'.[0].TestingAssemblyVersion = $version |
.[0].DownloadLinkTesting = $repo_url' \
repo.json > tmp.json && mv tmp.json repo.json
Expand Down

0 comments on commit e829a36

Please sign in to comment.