dev #53
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: Auto Release bot | |
| on: | |
| pull_request: | |
| types: [ closed ] | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| if: github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| outputs: | |
| draft_tag: ${{ steps.release_step.outputs.draft_tag }} | |
| steps: | |
| - uses: actions/create-github-app-token@v1 | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ steps.app-token.outputs.token }} | |
| ref: ${{ github.base_ref }} | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "lts/*" | |
| cache: "pnpm" | |
| - run: pnpm install --frozen-lockfile | |
| - run: git config --global user.name 'github-actions[bot]' | |
| - run: git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| - name: Fetch tags | |
| run: git fetch --tags | |
| # - name: Run release-it | |
| # id: release_step | |
| # run: | | |
| # git pull origin main | |
| # pnpm exec release-it --ci | |
| # env: | |
| # GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
| - name: Run release-it | |
| id: release_step | |
| run: | | |
| git pull origin main | |
| OUTPUT=$(pnpm exec release-it --ci) | |
| echo "$OUTPUT" | |
| # Extract the untagged draft release name | |
| DRAFT_TAG=$(echo "$OUTPUT" | grep -o 'releases/tag/[^ ]*' | sed 's|releases/tag/||') | |
| echo "draft_tag=$DRAFT_TAG" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
| - name: Log draft release tag | |
| run: | | |
| echo "The temporary draft release tag is: ${{ steps.release_step.outputs.draft_tag }}" | |
| - name: Write draft tag to file | |
| run: echo "${{ steps.release_step.outputs.draft_tag }}" > draft_tag.txt | |
| - name: Save draft tag artifact | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: draft_tag | |
| path: draft_tag.txt |