yew/.github/workflows/publish-website.yml
dependabot[bot] 443dba3cf8
Bump actions/checkout from 3 to 4 (#3433)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 19:12:26 +09:00

69 lines
2.3 KiB
YAML

name: Publish website
on:
workflow_run:
workflows: ["Build website"]
types:
- completed
jobs:
publish:
runs-on: ubuntu-latest
env:
PR_INFO_FILE: ".PR_INFO"
steps:
- if: github.event.workflow_run.conclusion != 'success'
name: Abort if build failed
run: |
echo "build failed"
exit 1
# need to checkout to get "firebase.json", ".firebaserc"
- uses: actions/checkout@v4
- name: Download build artifact
uses: Legit-Labs/action-download-artifact@v2
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
workflow: build-website.yml
run_id: ${{ github.event.workflow_run.id }}
name: website
path: website/build
- if: github.event.workflow_run.event == 'pull_request'
name: Download pr info
uses: Legit-Labs/action-download-artifact@v2
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
workflow: build-website.yml
run_id: ${{ github.event.workflow_run.id }}
name: pr-info
path: artifacts
- if: github.event.workflow_run.event == 'pull_request'
name: Apply pull request environment
run: |
pr_number=$(cat "artifacts/$PR_INFO_FILE")
if ! [[ "$pr_number" =~ ^[0-9]+$ ]]; then
echo "pr number invalid"
exit 1
fi
echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV
echo "PR_BRANCH=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV
echo "COMMIT_SHA=${{ github.event.workflow_run.head_sha }}" >> $GITHUB_ENV
- if: github.event.workflow_run.event == 'push'
name: Apply push environment
run: |
echo "CHANNEL_ID=live" >> $GITHUB_ENV
- name: Deploy to Firebase
uses: siku2/action-hosting-deploy@v1
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseToken: "${{ secrets.FIREBASE_TOKEN }}"
targets: website
channelId: "${{ env.CHANNEL_ID }}"
# link to the next version because that's what we care about
commentURLPath: "/docs/next"
# PR information
prNumber: "${{ env.PR_NUMBER }}"
prBranchName: "${{ env.PR_BRANCH }}"
commitSHA: "${{ env.COMMIT_SHA }}"