fix: Ordering and whitespaces #41
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: Build, test, and release | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6.0.1 | |
| - uses: actions/setup-node@v6.1.0 | |
| with: | |
| node-version-file: .node-version | |
| - run: npm install -g pnpm@latest-10 | |
| - run: pnpm i | |
| - run: pnpm run check | |
| - run: pnpm run test:coverage | |
| - run: pnpm run build | |
| - name: Integration test | |
| uses: ./ | |
| with: | |
| files: coverage/cobertura-coverage.xml | |
| release-please: | |
| runs-on: ubuntu-latest | |
| needs: build-and-test | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| - name: Get release PR branch | |
| id: rp_branch | |
| if: ${{ steps.release.outputs.prs_created == 'true' }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| BRANCH="$(echo '${{ steps.release.outputs.pr }}' | jq -r '.headBranchName')" | |
| if [ -z "$BRANCH" ] || [ "$BRANCH" = "null" ]; then | |
| echo "Release PR branch not found" >&2 | |
| echo '${{ steps.release.outputs.pr }}' | jq . >&2 | |
| exit 1 | |
| fi | |
| echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" | |
| - uses: actions/checkout@v6.0.1 | |
| if: ${{ steps.release.outputs.prs_created == 'true' }} | |
| with: | |
| ref: ${{ steps.rp_branch.outputs.branch }} | |
| - uses: actions/setup-node@v6.1.0 | |
| if: ${{ steps.release.outputs.prs_created == 'true' }} | |
| with: | |
| node-version-file: .node-version | |
| - name: Build, and commit | |
| if: ${{ steps.release.outputs.prs_created == 'true' }} | |
| run: | | |
| npm install -g pnpm@latest-10 | |
| pnpm i | |
| pnpm run build | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add -f dist/ | |
| if git diff --cached --quiet; then | |
| echo "No dist changes to commit." | |
| exit 0 | |
| fi | |
| git commit -m "chore: add dist for ${{ steps.release.outputs.tag_name }}" | |
| git push origin HEAD:${{ steps.rp_branch.outputs.branch }} |