chore(deps): bump the gomod-minor-and-patch group across 1 directory with 18 updates #321
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: PR Pre-release | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| build-artifacts: | |
| name: Build PR Artifacts | |
| if: ${{ github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'pre-release') }} | |
| runs-on: | |
| group: ubuntu-latest-large | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Set short SHA | |
| run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV" | |
| - name: Check if release already exists | |
| id: check-release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if gh release view "v0.0.0-${SHORT_SHA}" &>/dev/null; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| if: steps.check-release.outputs.exists == 'false' | |
| with: | |
| go-version-file: "go.mod" | |
| - name: Configure git for private modules | |
| if: steps.check-release.outputs.exists == 'false' | |
| env: | |
| GIT_AUTH_TOKEN: ${{ secrets.BOT_REPO_TOKEN }} | |
| run: git config --global url."https://speakeasybot:${GIT_AUTH_TOKEN}@github.com".insteadOf "https://github.com" | |
| - uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 | |
| if: steps.check-release.outputs.exists == 'false' | |
| with: | |
| version: '~> v2' | |
| args: release --snapshot --clean --config .goreleaser.pr.yaml | |
| - name: Create release | |
| if: steps.check-release.outputs.exists == 'false' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "v0.0.0-${SHORT_SHA}" \ | |
| --title "PR Build (${SHORT_SHA})" \ | |
| --notes "Built from commit ${{ github.event.pull_request.head.sha }} on PR #${{ github.event.pull_request.number }}" \ | |
| --prerelease \ | |
| dist/*.zip dist/checksums.txt | |
| - name: Comment install instructions on PR | |
| if: steps.check-release.outputs.exists == 'false' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh pr comment ${{ github.event.pull_request.number }} \ | |
| --body "### Pre-release build ready | |
| Install with: | |
| \`\`\`sh | |
| curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | VERSION=0.0.0-${SHORT_SHA} sh | |
| \`\`\` | |
| Built from commit \`${{ github.event.pull_request.head.sha }}\`" |