Skip to content

doc_changes_branches #409

doc_changes_branches

doc_changes_branches #409

name: 'Update docs branch'
on:
repository_dispatch:
types: [doc_changes_branches]
jobs:
update-docs:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.branch.outputs.branch }}
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # tag: v4.1.2
- 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@60edb5dd545a775178f52524783378180af0d1f8 # tag: v4.0.2
with:
node-version: 20
- name: Install dependencies
uses: bahmutov/npm-install@237ded403e6012a48281f4572eab0c8eafe55b3f # tag: v1.10.1
- 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 }}