Skip to content

Commit

Permalink
Update gh-pages.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
OllieJC authored Feb 15, 2024
1 parent cf77ba2 commit 3e2b7b9
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,51 @@ 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 }}' \
| awk -F '/' '{print $2}' \
| 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 }}
Expand Down

0 comments on commit 3e2b7b9

Please sign in to comment.