Stuff #650
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: Build Plugin | |
| env: | |
| plugin_name: HaselDebug | |
| on: | |
| push: | |
| paths-ignore: | |
| - .editorconfig | |
| - .gitattributes | |
| - .github/** | |
| - .gitignore | |
| - HaselDebug/Translations.json | |
| - CHANGELOG.md | |
| - LICENSE | |
| - README.md | |
| workflow_dispatch: | |
| inputs: | |
| dalamud_branch: | |
| description: 'Dalamud Branch' | |
| required: true | |
| default: 'master' | |
| type: choice | |
| options: | |
| - master | |
| - stg | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| env: | |
| NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - uses: denoland/setup-deno@v2 | |
| with: | |
| deno-version: v2.x | |
| - name: Extract .NET SDK version from global.json | |
| id: get_dotnet_version | |
| run: | | |
| deno run --allow-read --quiet --unstable - <<'EOF' >> "$GITHUB_OUTPUT" | |
| import { parse } from "jsr:@std/jsonc"; | |
| const content = await Deno.readTextFile("global.json"); | |
| const json = parse(content); | |
| console.log(`dotnet_version=${json.sdk.version}`); | |
| EOF | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| cache: true | |
| cache-dependency-path: ${{ env.plugin_name }}/packages.lock.json | |
| dotnet-version: ${{ steps.get_dotnet_version.outputs.dotnet_version }} | |
| - name: Determine Dalamud Branch | |
| id: branch | |
| run: | | |
| if [[ -n "${{ github.event.inputs.dalamud_branch }}" ]]; then | |
| echo "branch=${{ github.event.inputs.dalamud_branch }}" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.event.ref }}" == "refs/heads/stg" ]] || [[ "${{ github.event.head_commit.message }}" == "[stg]"* ]]; then | |
| echo "branch=stg" >> $GITHUB_OUTPUT | |
| else | |
| echo "branch=master" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Download Dalamud | |
| env: | |
| DALAMUD_URL: > | |
| ${{ fromJson('{ | |
| "master": "https://goatcorp.github.io/dalamud-distrib/latest.zip", | |
| "stg": "https://goatcorp.github.io/dalamud-distrib/stg/latest.zip" | |
| }')[steps.branch.outputs.branch] }} | |
| run: | | |
| curl -o latest.zip ${{ env.DALAMUD_URL }} | |
| mkdir -p ~/.xlcore/dalamud/Hooks/dev/ | |
| unzip latest.zip -d ~/.xlcore/dalamud/Hooks/dev/ | |
| - name: Restore dependencies | |
| run: dotnet restore --locked-mode | |
| - name: Build | |
| run: dotnet build --no-restore -c Release -clp:NoSummary | |
| - name: Rename manifest | |
| if: github.event_name != 'pull_request' | |
| run: mv bin/${{ env.plugin_name }}/${{ env.plugin_name }}.json bin/${{ env.plugin_name }}/manifest.json | |
| - name: Upload Build Artifact | |
| if: github.event_name != 'pull_request' | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| path: bin/${{ env.plugin_name }}/* | |
| release: | |
| name: Release | |
| needs: build | |
| if: success() && startsWith(github.ref, 'refs/tags/v') && github.event_name != 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download Build Artifact | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: artifact | |
| - name: Extract release notes | |
| id: extract-release-notes | |
| uses: ffurrer2/extract-release-notes@v3 | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: ${{ env.plugin_name }} ${{ github.ref_name }} | |
| body: ${{ steps.extract-release-notes.outputs.release_notes }} | |
| files: artifact/* | |
| - name: Trigger Repo Update | |
| uses: peter-evans/repository-dispatch@v4 | |
| with: | |
| token: ${{ secrets.PAT }} | |
| repository: ${{ github.repository_owner }}/MyDalamudPlugins | |
| event-type: new-release |