Skip to content

Merge pull request #756 from jj22ee/test-merge-approval #617

Merge pull request #756 from jj22ee/test-merge-approval

Merge pull request #756 from jj22ee/test-merge-approval #617

Workflow file for this run

name: Gatsby Publish
env:
DELTA_THRESHOLD: .90
on:
push:
branches:
- main
jobs:
publish-smoke-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- uses: enriikke/gatsby-gh-pages-action@v2
env:
GH_API_KEY: ${{ secrets.GITHUB_TOKEN }}
with:
access-token: ${{ secrets.demo }}
deploy-branch: smoke-test
verify-smoke-test:
runs-on: ubuntu-22.04
needs: publish-smoke-test
steps:
- name: Checkout Smoke Test Branch
uses: actions/[email protected]
with:
path: smoke-test
ref: smoke-test
- name: Calculate total lines in smoke-test branch
run: |
export ST_LC=$(find ./smoke-test -type f -print0 | wc -l --files0=- | tail -n 1 | cut -d ' ' -f 1)
echo $ST_LC
echo "SMOKE_TEST_LINE_COUNT=$ST_LC" >> $GITHUB_ENV
- name: Checkout Published Branch
uses: actions/[email protected]
with:
path: published
ref: gh-pages
- name: Calculate total lines in published branch
run: |
export PUB_LC=$(find ./published -type f -print0 | wc -l --files0=- | tail -n 1 | cut -d ' ' -f 1)
echo $PUB_LC
echo "PUBLISHED_LINE_COUNT=$PUB_LC" >> $GITHUB_ENV
- name: Generate percentile diff
run: |
export PERCENTILE_DIFF=$(bc<<<"scale=2;${{ env.SMOKE_TEST_LINE_COUNT}} / ${{ env.PUBLISHED_LINE_COUNT }}")
echo $PERCENTILE_DIFF
if [ 1 -eq $(bc<<<"$PERCENTILE_DIFF < ${{ env.DELTA_THRESHOLD }}") ]; then
exit 1
else
exit 0
fi
publish-live:
needs: verify-smoke-test
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
with:
ref: gh-pages
- name: merge commit push
env:
GITHUB_TOKEN: ${{ secrets.demo }}
run: |
git config --global user.name 'Gatsby Publish Workflow'
git config --global user.email '[email protected]'
git fetch --all
git reset --hard origin/smoke-test
git push -f origin gh-pages