Publish @shakerquiz/forms #75
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: Update and/or Publish package | |
| on: | |
| pull_request: | |
| types: [ closed ] | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| utilities: | |
| description: "Bump @shakerquiz/utilities@aquamarine ?" | |
| required: false | |
| default: false | |
| type: boolean | |
| contracts: | |
| description: "Bump @shakerquiz/contracts@latest ?" | |
| required: false | |
| default: false | |
| type: boolean | |
| pr: | |
| description: "Open PR ?" | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| id-token: write | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| if: github.event_name == 'workflow_dispatch' | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v6 | |
| if: github.event_name == 'workflow_dispatch' | |
| with: | |
| node-version: latest | |
| - run: npm i @shakerquiz/utilities@aquamarine --save-exact --prefer-online --save-dev | |
| if: github.event_name == 'workflow_dispatch' && inputs.utilities | |
| - run: npm i @shakerquiz/contracts@latest --save-exact --prefer-online --save-dev | |
| if: github.event_name == 'workflow_dispatch' && inputs.contracts | |
| - name: Commit changes | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add package.json package-lock.json | |
| git commit -m "bump @shakerquiz/* packages" || true | |
| - run: git checkout -b "chore/bump-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT" | |
| if: github.event_name == 'workflow_dispatch' && inputs.pr | |
| - run: git push origin HEAD | |
| if: github.event_name == 'workflow_dispatch' | |
| - name: Create PR from branch | |
| if: github.event_name == 'workflow_dispatch' && inputs.pr | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh pr create \ | |
| --title "bump @shakerquiz/* packages" \ | |
| --body "Automated dependency bump via workflow_dispatch." | |
| publish: | |
| needs: update | |
| if: | | |
| github.event.pull_request.merged == true || | |
| github.event_name == 'workflow_dispatch' && inputs.pr == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: latest | |
| - uses: oven-sh/setup-bun@v2 | |
| - run: git config user.name "github-actions[bot]" | |
| - run: git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - run: npm version patch | |
| - run: npm ci | |
| - run: npm publish | |
| - run: git commit -am "Commit autogenerated output" || true | |
| - run: git push --follow-tags |