Add output to build.yaml

This commit is contained in:
Ben C 2022-07-11 14:06:06 -04:00 committed by GitHub
parent 581efa14cb
commit 472ec35dd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 7 deletions

View File

@ -17,11 +17,18 @@ on:
required: false required: false
default: "Debug" default: "Debug"
type: string type: string
outputs:
schemas_changed:
description: 'Have the schemas been updated?'
value: ${{ jobs.Build.outputs.schemas_changed }}
jobs: jobs:
Build: Build:
runs-on: windows-latest runs-on: windows-latest
outputs:
schemas_changed: ${{ steps.changed_files.outputs.files_changed }}
steps: steps:
- name: Checkout Repo - name: Checkout Repo
@ -58,3 +65,9 @@ jobs:
name: NewHorizons-Schemas-${{ inputs.build_type }} name: NewHorizons-Schemas-${{ inputs.build_type }}
path: .\NewHorizons\Schemas path: .\NewHorizons\Schemas
- name: Verify Changed Schemas
uses: tj-actions/verify-changed-files@v9.1
id: changed_files
with:
files: NewHorizons/Schemas/**

View File

@ -19,6 +19,7 @@ jobs:
Update_Schemas: Update_Schemas:
name: 'Update Schemas' name: 'Update Schemas'
needs: Build needs: Build
if: ${{ needs.Build.outputs.schemas_changed }}
uses: './.github/workflows/update_schemas.yml' uses: './.github/workflows/update_schemas.yml'
with: with:
artifact_name: NewHorizons-Schemas-Debug artifact_name: NewHorizons-Schemas-Debug

View File

@ -28,6 +28,7 @@ jobs:
Update_Schemas: Update_Schemas:
name: 'Update Schemas' name: 'Update Schemas'
needs: Build needs: Build
if: ${{ needs.Build.outputs.schemas_changed && github.ref != 'refs/heads/dev' }} # Debug build will update schemas on dev, so don't run if we're on dev
uses: ./.github/workflows/update_schemas.yml uses: ./.github/workflows/update_schemas.yml
with: with:
artifact_name: NewHorizons-Schemas-Release artifact_name: NewHorizons-Schemas-Release

View File

@ -21,12 +21,6 @@ jobs:
name: ${{ inputs.artifact_name }} name: ${{ inputs.artifact_name }}
path: NewHorizons/Schemas/ path: NewHorizons/Schemas/
- name: Verify Changed Schemas
uses: tj-actions/verify-changed-files@v9.1
id: changed_files
with:
files: NewHorizons/Schemas/**
- name: Commit Schemas - name: Commit Schemas
if: steps.changed_files.outputs.files_changed == 'true' if: steps.changed_files.outputs.files_changed == 'true'
run: | run: |
@ -36,7 +30,6 @@ jobs:
git commit -m "Updated Schemas" git commit -m "Updated Schemas"
- name: Push Schemas - name: Push Schemas
if: ${{ (steps.changed_files.outputs.files_changed == 'true') && (github.event_name != 'pull_request') }}
uses: ad-m/github-push-action@master uses: ad-m/github-push-action@master
with: with:
github_token: ${{ secrets.github_token }} github_token: ${{ secrets.github_token }}