feat: add visual regression tests for all components (#1302) #546
This file contains hidden or 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: Release Generator | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0 | |
| id: sre_app_token | |
| with: | |
| app-id: ${{ secrets.CDS_RELEASE_BOT_APP_ID }} | |
| private-key: ${{ secrets.CDS_RELEASE_BOT_PRIVATE_KEY }} | |
| # --- Run release please to open a release PR --- | |
| - uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1 | |
| id: release | |
| with: | |
| token: ${{ steps.sre_app_token.outputs.token }} | |
| # --- Find the open release PR created/updated by release-please --- | |
| - name: Find release PR branch | |
| id: rp_pr | |
| env: | |
| GH_TOKEN: ${{ steps.sre_app_token.outputs.token }} | |
| run: | | |
| set -euo pipefail | |
| # Default label release-please applies to the open PR | |
| PR_JSON=$(gh pr list \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --state open \ | |
| --label "autorelease: pending" \ | |
| --json number,headRefName \ | |
| --limit 1) | |
| if [ "$(echo "$PR_JSON" | jq 'length')" -eq 0 ]; then | |
| echo "No open release PR found (label: autorelease: pending)." | |
| exit 0 | |
| fi | |
| PR_BRANCH=$(echo "$PR_JSON" | jq -r '.[0].headRefName') | |
| PR_NUM=$(echo "$PR_JSON" | jq -r '.[0].number') | |
| echo "branch=$PR_BRANCH" >> "$GITHUB_OUTPUT" | |
| echo "number=$PR_NUM" >> "$GITHUB_OUTPUT" | |
| # --- Checkout the release PR branch --- | |
| - name: Checkout release PR branch | |
| if: ${{ steps.rp_pr.outputs.branch != '' }} | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| ref: ${{ steps.rp_pr.outputs.branch }} | |
| fetch-depth: 0 | |
| token: ${{ steps.sre_app_token.outputs.token }} | |
| # --- Copy changelog and commit into the same PR branch --- | |
| - name: Sync root CHANGELOG.md from packages/web/CHANGELOG.md | |
| if: ${{ steps.rp_pr.outputs.branch != '' }} | |
| run: | | |
| set -euo pipefail | |
| cp packages/web/CHANGELOG.md CHANGELOG.md | |
| if git diff --quiet -- CHANGELOG.md; then | |
| echo "Root CHANGELOG.md already matches packages/web/CHANGELOG.md" | |
| exit 0 | |
| fi | |
| git config user.name "cds-release-bot[bot]" | |
| git config user.email "cds-release-bot[bot]@users.noreply.github.com" | |
| git add CHANGELOG.md | |
| git commit -m "chore(changelog): sync root CHANGELOG.md" | |
| git push |