-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: deploy Storybook book demo on PR (#4031)
Co-authored-by: GitHub Actions Bot <> Co-authored-by: Frederic Beaudoin <[email protected]>
- Loading branch information
1 parent
e8b2e5e
commit e1e96e5
Showing
8 changed files
with
123 additions
and
48 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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: 'Publish PR review site' | ||
description: Publish PR review stuff | ||
|
||
inputs: | ||
token: | ||
description: 'GitHub token' | ||
required: true | ||
copy: | ||
description: 'Files to copy' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: coveo/ui-kit-prs | ||
path: prs | ||
sparse-checkout: '${{ github.event.pull_request.number }}' | ||
token: ${{inputs.token}} | ||
- name: 'Setup branch' | ||
run: | | ||
if [[ -z $(git ls-remote --heads origin refs/heads/${{github.event.pull_request.number}} | tr -s '[:blank:]') ]]; then | ||
git switch -c "${{github.event.pull_request.number}}" | ||
else | ||
git fetch origin "refs/heads/${{github.event.pull_request.number}}" | ||
git switch "${{github.event.pull_request.number}}" | ||
git pull | ||
fi | ||
working-directory: prs | ||
shell: bash | ||
- name: 'Ensure clean directory exists' | ||
run: | | ||
rm -rf "${{github.event.pull_request.number}}" | ||
mkdir -p "${{github.event.pull_request.number}}" | ||
working-directory: prs | ||
shell: bash | ||
- name: 'Copy files' | ||
if: ${{inputs.copy}} | ||
run: | | ||
cp -R packages/atomic/dist-storybook prs/${{github.event.pull_request.number}} | ||
shell: bash | ||
- name: 'Commit/Push' | ||
run: | | ||
git config user.name "GitHub Actions Bot" | ||
git config user.email "<>" | ||
git add "${{github.event.pull_request.number}}" | ||
git commit -m "Add ${{github.sha}}" | ||
git push --set-upstream origin ${{github.event.pull_request.number}} | ||
working-directory: prs | ||
shell: bash | ||
- name: 'Open & put PR in merge queue' | ||
run: | | ||
gh pr new -f | ||
gh pr merge | ||
env: | ||
GH_TOKEN: ${{inputs.token}} | ||
working-directory: prs | ||
shell: bash |
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,13 @@ | ||
name: 'Delete PR artifact on merge' | ||
on: | ||
pull_request: | ||
types: [closed] | ||
jobs: | ||
delete: | ||
environment: PR Artifacts | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/publish-pr-review-site | ||
with: | ||
token: ${{ secrets.GH_PUBLISH_TOKEN }} |
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
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,7 @@ | ||
import {context} from '@actions/github'; | ||
|
||
export const buildLiveExampleReport = async () => | ||
[ | ||
'## Live demo links', | ||
`* [Storybook](https://coveo.github.io/ui-kit-prs/${context.payload.pull_request.number}/dist-storybook/)`, | ||
].join('\n\n'); |
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
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