[PR] DTR-related updates #10
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: Build | |
# Put your personal access token in a repository secret named PAT for cross-repository access | |
permissions: | |
contents: write | |
on: | |
workflow_dispatch: | |
push: | |
paths-ignore: | |
- '*.md' | |
branches: | |
- master | |
- main | |
- release | |
env: | |
INTERNAL_NAME: PositionalGuide | |
CONFIGURATION: Release | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
DOTNET_NOLOGO: true | |
jobs: | |
precheck: | |
runs-on: ubuntu-latest | |
outputs: | |
buildVersion: ${{ steps.data.outputs.buildVersion }} | |
tagName: ${{ steps.data.outputs.tagName }} | |
tagExists: ${{ steps.check-version-tag.outputs.tagExists }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Load values | |
id: data | |
run: | | |
buildVersion=$(grep -Ei '<version>[^<]+</version>' "${{ env.INTERNAL_NAME }}/${{ env.INTERNAL_NAME }}.csproj" | sed -e 's/.\+<version>\([^<]\+\)<.\+/\1/i' -) | |
echo "buildVersion=$buildVersion" >> "$GITHUB_OUTPUT" | |
echo "tagName=v$buildVersion" >> "$GITHUB_OUTPUT" | |
shell: bash | |
- name: Check if version exists | |
id: check-version-tag | |
run: | | |
if git show-ref --quiet --tags "${{ steps.data.outputs.tagName }}"; then echo "tagExists=true" >> "$GITHUB_OUTPUT"; else echo "tagExists=false" >> "$GITHUB_OUTPUT"; fi | |
shell: bash | |
- name: Debug | |
run: | | |
echo "Current version is ${{ steps.data.outputs.buildVersion }} for tag ${{ steps.data.outputs.tagName }} (exists = ${{ steps.check-version-tag.outputs.tagExists }})" | |
shell: bash | |
build: | |
needs: precheck | |
if: needs.precheck.outputs.tagExists == 'false' | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup MSBuild | |
uses: microsoft/[email protected] | |
- name: Download Dalamud | |
run: | | |
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/latest.zip -OutFile latest.zip | |
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev\" | |
- name: Restore | |
run: dotnet restore -r win | |
- name: Build | |
run: dotnet build -c ${{ env.CONFIGURATION }} --no-restore | |
- name: Upload build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: PluginRepoZip | |
path: ${{ env.INTERNAL_NAME }}/bin/${{ env.CONFIGURATION }}/${{ env.INTERNAL_NAME }} | |
if-no-files-found: error | |
retention-days: 14 | |
- name: Tag | |
run: | | |
git tag -am "[Automated build $BUILD_VERSION]" "$TAG_NAME" | |
git push origin "$TAG_NAME" | |
shell: bash | |
env: | |
BUILD_VERSION: ${{ needs.precheck.outputs.buildVersion }} | |
TAG_NAME: ${{ needs.precheck.outputs.tagName }} | |
GIT_AUTHOR_NAME: GitHub Action | |
GIT_COMMITTER_NAME: GitHub Action | |
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com | |
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Submit pull request | |
uses: daemitus/DalamudPluginPR2@master | |
with: | |
token: ${{ secrets.PAT }} | |
plugin_name: ${{ env.INTERNAL_NAME }} | |
plugin_owners: PrincessRTFM |