Skip to content

Update test_release.yml #16

Update test_release.yml

Update test_release.yml #16

Workflow file for this run

name: Test Release
# Add a concurrency group incase a tag is created, deleted, and then recreated while a release is in progress.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Only run this workflow when a tag is pushed when the tag starts with "v".
on:
push:
tags:
- "testing_*"
# So we can use the GitHub API to create releases with the run token.
permissions:
contents: write
jobs:
TestRelease:
if: github.event.pull_request.draft == false # Ignore draft PRs
runs-on: ubuntu-latest
defaults:
run:
working-directory: Meddle/Meddle.Plugin/
shell: bash
env:
DALAMUD_HOME: /tmp/dalamud
IsCI: true
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: true # Grab any submodules that may be required
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Download Dalamud Library
run: |

Check failure on line 41 in .github/workflows/test_release.yml

View workflow run for this annotation

GitHub Actions / Test Release

Invalid workflow file

The workflow is not valid. .github/workflows/test_release.yml (Line: 41, Col: 20): Unrecognized named-value: 'BASH_REMATCH'. Located at position 1 within expression: BASH_REMATCH[1]}" version="${BASH_REMATCH[2]}" echo "Custom Path: $custom_path" echo "Version: $version" wget https://goatcorp.github.io/dalamud-distrib/$custom_path/latest.zip -O /tmp/dalamud.zip else version=$(echo ${{ github.ref_name
if [[ ${{ github.ref_name }} =~ ^testing_(.*)_v(.*)$ ]]; then
custom_path="${{BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
echo "Custom Path: $custom_path"
echo "Version: $version"
wget https://goatcorp.github.io/dalamud-distrib/$custom_path/latest.zip -O /tmp/dalamud.zip
else
version=$(echo ${{ github.ref_name }} | sed 's/testing_v//')
echo "Version: $version"
wget https://goatcorp.github.io/dalamud-distrib/latest.zip -O /tmp/dalamud.zip
fi
- name: Restore Dependencies
run: dotnet restore
- name: Build plugin in release mode
run: |
if [[ ${{ github.ref_name }} =~ ^testing_(.*)_v(.*)$ ]]; then
custom_path="${BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
echo "Custom Path: $custom_path"
echo "Version: $version"
dotnet build -c Release --no-restore --nologo -o ./bin/Release -p:Version=$version -p:AssemblyVersion=$version -p:FileVersion=$version
else
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
fi
- name: Generate Checksums
working-directory: Meddle/Meddle.Plugin/bin/Release/Meddle.Plugin
run: |
sha512sum latest.zip >> checksums.sha512
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
Meddle/Meddle.Plugin/bin/Release/Meddle.Plugin/latest.zip
Meddle/Meddle.Plugin/bin/Release/Meddle.Plugin/checksums.sha512
prerelease: false # Releases cant be marked as prereleases as Dalamud wont be able to find them
append_body: true # Append the release notes to the release body
body_path: .github/release-notices.md # These notes are automatically added to the release body every time.
generate_release_notes: true # Automatically makes a release body from PRs since the last release.
fail_on_unmatched_files: true # If the files arent found, fail the workflow and abort the release.
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Release Artifacts
path: |
Meddle/Meddle.Plugin/bin/Release/Meddle.Plugin/latest.zip
Meddle/Meddle.Plugin/bin/Release/Meddle.Plugin/checksums.sha512
- name: Update repo.json
run: |
cd ../../
if [[ ${{ github.ref_name }} =~ ^testing_(.*)_v(.*)$ ]]; then
custom_path="${BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
echo "Custom Path: $custom_path"
echo "Version: $version"
release_version=$version
repo_url="$(echo "${{ github.server_url }}/${{ github.repository }}" | sed 's/#/\\#/g')"
echo "Repo URL: $repo_url"
else
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"
fi
# Update the JSON file using jq
jq --arg release_version "$release_version" \
--arg repo_url "$repo_url/releases/download/${{ github.ref_name }}/latest.zip" \
'.[0].TestingAssemblyVersion = $release_version |
.[0].DownloadLinkTesting = $repo_url' \
repo.json > tmp.json && mv tmp.json repo.json
cat repo.json
git add repo.json
git config --local user.name "github-actions [bot]"
git config --local user.email "[email protected]"
git commit -m "Update repo.json for ${{ github.ref_name }}"
git push origin HEAD:main