feat!: add support to update header based on action name #616
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: 'CI' | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [20] | |
permissions: | |
pull-requests: write | |
contents: write | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v3 | |
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # ratchet:actions/setup-node@v3 | |
with: | |
node-version: 20 | |
# build and test action | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Check format and lint | |
run: yarn run format-check && yarn lint | |
- name: Build and package | |
run: yarn build && yarn run package | |
- name: Update docs | |
uses: './' | |
- name: Update dist in the repository | |
if: github.ref != 'refs/heads/main' | |
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # ratchet:stefanzweifel/[email protected] | |
with: | |
commit_message: 'chore(ci): Updating dist and docs' | |
file_pattern: 'dist/* README.md' | |
- name: Create Pull Request (main branch only) | |
if: github.ref == 'refs/heads/main' | |
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # ratchet:peter-evans/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: 'chore(ci): Updating dist and docs' | |
title: 'chore(ci): Updating dist and docs' | |
branch: update-docs | |
branch-suffix: random | |
base: ${{ github.event.pull_request.base.ref }} | |
delete-branch: true | |
release: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get app installation token | |
uses: npalm/action-app-token@dd4bb16d91ced5659bc618705c96b822c5a42136 # v1.1.0 | |
id: app-token | |
with: | |
appId: ${{ vars.APP_ID }} | |
appPrivateKeyBase64: ${{ secrets.APP_PRIVATE_KEY_BASE64 }} | |
appInstallationType: repo | |
appInstallationValue: ${{ github.repository }} | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Release | |
uses: google-github-actions/release-please-action@e0b9d1885d92e9a93d5ce8656de60e3b806e542c # ratchet:google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
release-type: simple | |
next-version: v2.0.0 | |
last-release-sha: b62a69e27ae389aa92b450f647d37409b9277bf0 |