From 3e2b7b98738b9e4096012e6d6049548dbb6dc863 Mon Sep 17 00:00:00 2001 From: OllieJC <5426038+OllieJC@users.noreply.github.com> Date: Thu, 15 Feb 2024 22:44:53 +0000 Subject: [PATCH] Update gh-pages.yml --- .github/workflows/gh-pages.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 6814478..da51f80 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -18,10 +18,14 @@ concurrency: cancel-in-progress: false jobs: - # Build job - build: + check: runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + is_template: ${{ steps.is_template.outputs.is_template }} steps: + - name: Checkout + uses: actions/checkout@v4 - run: | echo "REPOSITORY_NAME=$( echo '${{ github.repository }}' \ @@ -29,30 +33,36 @@ jobs: | tr '-' '_' \ | tr '[:upper:]' '[:lower:]' \ )" >> $GITHUB_ENV - - run: | + - id: is_template + run: | if [ "$REPOSITORY_NAME" == "mta_sts_template" ]; then - echo "IS_TEMPLATE=true" >> $GITHUB_ENV + echo "is_template=true" >> "$GITHUB_OUTPUT" else - echo "IS_TEMPLATE=$(ls .github/template.yml &> /dev/null && echo true || echo false)" >> $GITHUB_ENV + echo "is_template=$(ls .github/template.yml &> /dev/null && echo true || echo false)" >> "$GITHUB_OUTPUT" fi - - name: Quit if template - if: env.IS_TEMPLATE == 'true' - run: | - exit 1 + + build: + if: ${{ needs.check.outputs.is_template == 'false' }} + runs-on: ubuntu-latest + steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Pages + if: env.IS_TEMPLATE != 'true' uses: actions/configure-pages@v4 - name: Build with Jekyll + if: env.IS_TEMPLATE != 'true' uses: actions/jekyll-build-pages@v1 with: source: ./ destination: ./_site - name: Upload artifact + if: env.IS_TEMPLATE != 'true' uses: actions/upload-pages-artifact@v3 # Deployment job deploy: + if: ${{ needs.check.outputs.is_template == 'false' }} environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }}