doc_changes_branches #383
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
name: 'Update docs branch' | |
on: | |
repository_dispatch: | |
types: [doc_changes_branches] | |
jobs: | |
update-docs: | |
runs-on: ubuntu-latest | |
outputs: | |
branch: ${{ steps.branch.outputs.branch }} | |
steps: | |
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag: v3.3.0 | |
- name: 'Switch branches' | |
# We switch to the version branch or create a new one if needed | |
run: git fetch origin && git checkout -t origin/v${{ github.event.client_payload.branch}} || git checkout -b v${{ github.event.client_payload.branch}} | |
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # tag: v3.6.0 | |
with: | |
node-version: 16 | |
- name: Install dependencies | |
uses: bahmutov/npm-install@8add8c6d2c8586964896d9fdc639e021312a643f # tag: v1.8.28 | |
- name: 'Prebuild' | |
run: 'yarn pre-build ${{ github.event.client_payload.sha }}' | |
- name: 'Push changes or create PR' | |
run: 'yarn process-docs-changes' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: branch | |
name: Calculate branch | |
run: | | |
[[ $(git branch --show-current) =~ ^v[0-9]+-x-y$ ]] && echo "branch=version" >> $GITHUB_OUTPUT || echo "branch=other" >> $GITHUB_OUTPUT | |
- name: Show branch | |
run: echo ${{ steps.branch.outputs.branch }} | |
# GitHub will not kick the "push-XXX" workflow so we have to publish from here | |
build-and-deploy: | |
needs: [update-docs] | |
# If we are in a version branch, it means we have pushed the changed directly and should deploy | |
if: ${{ needs.update-docs.outputs.branch == 'version' }} | |
uses: electron/website/.github/workflows/build-and-deploy.yml@main | |
with: | |
branch: version | |
secrets: | |
SAS: ${{ secrets.SAS }} |