Test Release #23
This file contains hidden or 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: Test Release | |
| # Add a concurrency group incase a release is triggered multiple times | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # Manual trigger with inputs for version and optional dalamud branch | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., 1.0.0)' | |
| required: true | |
| type: string | |
| dalamud_branch: | |
| description: 'Dalamud branch/path (optional, leave empty for latest)' | |
| required: false | |
| type: string | |
| # So we can use the GitHub API to create releases with the run token. | |
| permissions: | |
| contents: write | |
| jobs: | |
| TestRelease: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: Meddle/Meddle.Plugin/ | |
| shell: bash | |
| env: | |
| DALAMUD_HOME: /tmp/dalamud | |
| IsCI: true | |
| VERSION: ${{ github.event.inputs.version }} | |
| DOWNLOAD_PATH: ${{ github.event.inputs.dalamud_branch }} | |
| 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: 10.0.x | |
| - name: Display build information | |
| run: | | |
| echo "Building version: ${{ env.VERSION }}" | |
| echo "Dalamud branch/path: ${{ env.DOWNLOAD_PATH }}" | |
| echo "Building on branch: ${{ github.ref_name }}" | |
| - name: Download Dalamud Library | |
| run: | | |
| 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: | | |
| echo "Building Meddle.Plugin version: ${{ env.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: | | |
| sha512sum latest.zip >> checksums.sha512 | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: testing_v${{ env.VERSION }}${{ env.DOWNLOAD_PATH && format('_{0}', env.DOWNLOAD_PATH) || '' }} | |
| name: Test Release v${{ env.VERSION }}${{ env.DOWNLOAD_PATH && format(' ({0})', env.DOWNLOAD_PATH) || '' }} | |
| 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: Checkout main branch to update repo.json | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| path: main-branch | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update repo.json on main branch | |
| run: | | |
| cd ../../main-branch | |
| repo_url="$(echo "${{ github.server_url }}/${{ github.repository }}" | sed 's/#/\\#/g')" | |
| echo "Repo URL: $repo_url" | |
| # Create tag name with optional dalamud branch suffix | |
| tag_name="testing_v${{ env.VERSION }}" | |
| if [ ! -z "${{ env.DOWNLOAD_PATH }}" ]; then | |
| tag_name="${tag_name}_${{ env.DOWNLOAD_PATH }}" | |
| fi | |
| # Update the JSON file using jq | |
| jq --arg version "${{ env.VERSION }}" \ | |
| --arg repo_url "$repo_url/releases/download/$tag_name/latest.zip" \ | |
| '.[0].TestingAssemblyVersion = $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 "github-actions@users.noreply.github.com" | |
| # Create commit message with optional dalamud branch info | |
| commit_msg="Update repo.json for testing release v${{ env.VERSION }}" | |
| if [ ! -z "${{ env.DOWNLOAD_PATH }}" ]; then | |
| commit_msg="${commit_msg} (${{ env.DOWNLOAD_PATH }})" | |
| fi | |
| git commit -m "$commit_msg" | |
| git push origin main |