task: add auto (#32) #23
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
| # test | |
| name: version, tag and github release | |
| on: | |
| push: | |
| branches: [main] | |
| # support manual release in case something goes wrong and needs to be repeated or tested | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: tag that needs to publish | |
| type: string | |
| required: true | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.release.tag_name || inputs.tag }} | |
| token: ${{ secrets.DISPATCH_ACCESS_TOKEN }} | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: yarn | |
| - name: Upgrade npm for trusted publishing | |
| run: npm install -g npm@^11.5.1 | |
| - name: Create Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.DISPATCH_ACCESS_TOKEN }} | |
| NPM_TOKEN: '' # placeholder to prevent yarn from failing on ${NPM_TOKEN} expansion (OIDC token is written to ~/.npmrc by auto) | |
| run: | | |
| yarn install --frozen-lockfile | |
| yarn build | |
| yarn release |