forked from primer/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add deployment workflows for GitHub Pages (primer#2028)
- Loading branch information
Showing
9 changed files
with
57 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,18 @@ | ||
name: Deploy | ||
on: | ||
push: | ||
branches-ignore: | ||
- 'main' | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
deploy-preview: | ||
if: ${{ github.repository == 'primer/react' }} | ||
name: Preview | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create GitHub deployment | ||
uses: chrnorm/[email protected] | ||
id: deployment | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
environment: Preview | ||
|
||
- name: Deploy with Vercel | ||
uses: amondnet/vercel-action@v20 | ||
id: vercel-action | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
vercel-token: ${{ secrets.VERCEL_TOKEN_SHARED }} | ||
github-comment: false | ||
vercel-org-id: ${{ secrets.VERCEL_ORG_ID_SHARED }} | ||
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | ||
|
||
- name: Update deployment status (success) | ||
if: success() | ||
uses: chrnorm/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
environment_url: ${{ steps.vercel-action.outputs.preview-url }} | ||
state: 'success' | ||
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | ||
|
||
- name: Update deployment status (failure) | ||
if: failure() | ||
uses: chrnorm/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
state: 'failure' | ||
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | ||
uses: primer/.github/.github/workflows/deploy_preview.yml@main | ||
with: | ||
node_version: 16 | ||
build: npm run build:docs:preview | ||
output_dir: docs/public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
guard: | ||
name: Guard | ||
|
@@ -16,55 +23,21 @@ jobs: | |
|
||
- id: changeset-count | ||
run: echo "::set-output name=change_count::$(ls .changeset/*.md | grep -v README | wc -l | xargs)" | ||
|
||
# Log changeset count for debugging purposes | ||
- name: Log changeset count | ||
run: echo ${{ steps.changeset-count.outputs.change_count }} | ||
|
||
deploy: | ||
name: Production | ||
needs: [guard] | ||
#if: ${{ needs.guard.outputs.should_deploy == true }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# Log guard output for debugging purposes | ||
- name: Log guard output | ||
run: echo ${{ needs.guard.outputs.should_deploy }} | ||
|
||
- name: Create GitHub deployment | ||
uses: chrnorm/[email protected] | ||
id: deployment | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
environment: Production | ||
|
||
- name: Deploy with Vercel | ||
if: ${{ steps.changeset-count.outputs.CHANGE_COUNT == 0 }} | ||
uses: amondnet/vercel-action@v20 | ||
id: vercel-action | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
vercel-token: ${{ secrets.VERCEL_TOKEN_SHARED }} | ||
vercel-args: '--prod' | ||
github-comment: false | ||
vercel-org-id: ${{ secrets.VERCEL_ORG_ID_SHARED }} | ||
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | ||
|
||
- name: Update deployment status (success) | ||
if: success() | ||
uses: chrnorm/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
environment_url: ${{ steps.vercel-action.outputs.preview-url }} | ||
state: 'success' | ||
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | ||
|
||
- name: Update deployment status (failure) | ||
if: failure() | ||
uses: chrnorm/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
state: 'failure' | ||
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | ||
deploy: | ||
name: Production | ||
needs: [guard] | ||
#if: ${{ needs.guard.outputs.should_deploy == true }} | ||
uses: primer/.github/.github/workflows/deploy.yml@main | ||
with: | ||
node_version: 16 | ||
build: npm run build:docs | ||
output_dir: docs/public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if [ -n "$1" ]; then | ||
cd docs && npm run build:preview && cd ../ && npm run build:storybook preview | ||
else | ||
cd docs && npm run build && cd ../ && npm run build:storybook | ||
fi | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters