build(deps): bump validator from 13.15.15 to 13.15.20 #25
Workflow file for this run
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: Publish | |
| on: | |
| pull_request: | |
| branches: | |
| - 'main' | |
| types: | |
| - closed | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: false | |
| jobs: | |
| publish: | |
| if: ${{ (github.head_ref == 'release-stable' || github.head_ref == 'release-beta') && github.event.pull_request.merged == true }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: 1 | |
| - name: Extract version from lerna.json | |
| run: echo "value=$(jq .version lerna.json -r)" >> $GITHUB_OUTPUT | |
| id: current_version | |
| - name: Determine Release type | |
| shell: bash | |
| run: echo "value=$([[ ${{ steps.current_version.outputs.value }} =~ beta ]] && echo "beta" || echo "stable")" >> $GITHUB_OUTPUT | |
| id: release_type | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: | | |
| yarn install --frozen-lockfile | |
| yarn lerna link | |
| - name: Bump versions | |
| id: bump | |
| run: | | |
| git config --global user.name 'github-actions'; | |
| git config --global user.email '[email protected]'; | |
| echo ".npmrc" >> .git/info/exclude | |
| echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc; | |
| yarn lerna publish from-package --summary-file=${{ runner.temp }}/ --yes | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Get release commit | |
| shell: bash | |
| run: | | |
| COMMIT_HASH=$(git rev-parse --verify HEAD); | |
| echo "sha=$COMMIT_HASH" >> $GITHUB_OUTPUT | |
| id: release_commit | |
| - uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const fs = require('fs'); | |
| const releaseType = "${{ steps.release_type.outputs.value }}"; | |
| const summary = JSON.parse(fs.readFileSync('${{ runner.temp }}/lerna-publish-summary.json', 'utf8')); | |
| const packages = summary.map(pkg => `**${pkg.packageName}@${pkg.version}**\n\`\`\`bash\nyarn add ${pkg.packageName}@${{ steps.branch_name.outputs.name }}\n\`\`\``).join('\n'); | |
| const body = `🎉 ${releaseType === 'stable' ? "Stable" : "Beta"} Release!\n\n${packages}` | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: body | |
| }); | |
| github.rest.repos.createCommitComment({ | |
| commit_sha: "${{ steps.release_commit.outputs.sha }}", | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body, | |
| }); |