chore: update CI to check for difs when generating docs #2465
Workflow file for this run
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: Build Artifacts | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
jobs: | |
build-artifacts: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.base.sha }} | |
fetch-depth: 0 | |
- name: Grab version in `package.json` in main | |
run: echo "version=$(cat package.json | jq -r .version)" >> $GITHUB_OUTPUT | |
id: base-version | |
- name: Checkout develop branch | |
uses: actions/checkout@v3 | |
- name: Grab version in `package.json` in develop | |
run: echo "version=$(cat package.json | jq -r .version)" >> $GITHUB_OUTPUT | |
id: new-version | |
- name: Compare versions | |
uses: madhead/semver-utils@latest | |
id: comparison | |
with: | |
version: ${{ steps.new-version.outputs.version }} | |
compare-to: ${{ steps.base-version.outputs.version }} | |
- name: Check if version increased | |
id: check | |
run: | | |
[[ ">" == "${{ steps.comparison.outputs.comparison-result }}" ]] && echo "changed=true" || echo "changed=false" >> "$GITHUB_OUTPUT" | |
# Trigger Release | |
- name: Repository Dispatch | |
if: github.event_name == 'push' && steps.check.outputs.changed == 'true' | |
uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }} | |
event-type: trigger-release | |
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' |