2021-04-05 20:25:49 +03:00
|
|
|
name: Deploy
|
2021-04-06 04:25:02 +03:00
|
|
|
on:
|
|
|
|
push:
|
2021-04-06 04:40:16 +03:00
|
|
|
branches:
|
2021-04-20 18:44:13 +03:00
|
|
|
- 'main'
|
2022-04-20 02:26:47 +03:00
|
|
|
|
|
|
|
permissions:
|
2022-04-20 12:15:26 +03:00
|
|
|
contents: write
|
2022-04-20 02:26:47 +03:00
|
|
|
pages: write
|
|
|
|
id-token: write
|
2022-04-20 12:15:26 +03:00
|
|
|
deployments: write
|
|
|
|
issues: write
|
|
|
|
statuses: write
|
|
|
|
checks: write
|
2022-04-20 02:26:47 +03:00
|
|
|
|
2021-04-05 20:25:49 +03:00
|
|
|
jobs:
|
2022-04-20 02:26:47 +03:00
|
|
|
guard:
|
|
|
|
name: Guard
|
2021-04-06 02:02:51 +03:00
|
|
|
runs-on: ubuntu-latest
|
2022-04-20 02:26:47 +03:00
|
|
|
outputs:
|
|
|
|
# To avoid deploying documentation for unrelease changes, we check the number of changeset files.
|
|
|
|
# If it's 0, we deploy.
|
|
|
|
should_deploy: ${{ steps.changeset-count.outputs.change_count == 0 }}
|
2021-04-05 20:25:49 +03:00
|
|
|
steps:
|
2022-05-03 22:11:22 +03:00
|
|
|
- uses: actions/checkout@v3
|
2021-04-06 04:31:49 +03:00
|
|
|
|
2021-04-06 04:25:02 +03:00
|
|
|
- id: changeset-count
|
2022-04-20 02:26:47 +03:00
|
|
|
run: echo "::set-output name=change_count::$(ls .changeset/*.md | grep -v README | wc -l | xargs)"
|
2021-04-06 04:31:49 +03:00
|
|
|
|
2022-04-20 02:26:47 +03:00
|
|
|
# Log changeset count for debugging purposes
|
|
|
|
- name: Log changeset count
|
|
|
|
run: echo ${{ steps.changeset-count.outputs.change_count }}
|
|
|
|
|
|
|
|
# Log guard output for debugging purposes
|
|
|
|
- name: Log guard output
|
|
|
|
run: echo ${{ needs.guard.outputs.should_deploy }}
|
|
|
|
deploy:
|
2022-04-20 12:04:27 +03:00
|
|
|
if: ${{ github.repository == 'primer/css' }}
|
2022-04-20 02:26:47 +03:00
|
|
|
name: Production
|
|
|
|
needs: [guard]
|
2022-04-20 12:15:26 +03:00
|
|
|
uses: primer/.github/.github/workflows/deploy.yml@main
|
2022-04-20 02:26:47 +03:00
|
|
|
with:
|
|
|
|
node_version: 14
|
2022-04-20 22:15:15 +03:00
|
|
|
install: yarn && cd docs && yarn && cd ..
|
2022-04-20 02:26:47 +03:00
|
|
|
build: yarn build:docs
|
|
|
|
output_dir: docs/public
|