workflow improvements, I hope #1
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: Deploy | ||
# 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 | ||
uses: ./.github/workflows/compile.yml | ||
Check failure on line 55 in .github/workflows/deploy.yml GitHub Actions / DeployInvalid workflow file
|
||
tag: | ||
needs: | ||
- precheck | ||
- build | ||
if: needs.precheck.outputs.tagExists == 'false' | ||
steps: | ||
- name: Tag release commit | ||
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: tag | ||
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 |