Skip to content

feat(cli): add project remove --all (#17) #19

feat(cli): add project remove --all (#17)

feat(cli): add project remove --all (#17) #19

name: release-please
on:
push:
branches:
- main
workflow_dispatch:
inputs:
release_as:
description: "Force next version (example: 1.3.0)"
required: false
type: string
permissions:
actions: write
checks: write
contents: write
pull-requests: write
issues: write
concurrency:
group: release-please-${{ github.ref }}
cancel-in-progress: true
jobs:
open-release-pr:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Open or update release PR
uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: go
skip-github-release: true
release-as: ${{ github.event.inputs.release_as }}
verify-release-pr:
if: github.event_name == 'workflow_dispatch'
needs: open-release-pr
runs-on: ubuntu-latest
steps:
- name: Resolve release PR and create pending check
id: prep
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const prs = await github.rest.pulls.list({
owner,
repo,
state: 'open',
base: 'main',
head: `${owner}:release-please--branches--main`,
per_page: 1,
});
if (prs.data.length === 0) {
core.setOutput('should_run', 'false');
core.info('No open release-please PR found; skipping verify.');
return;
}
const pr = prs.data[0];
const headSha = pr.head.sha;
if (!headSha) {
core.setFailed(`Unable to resolve head SHA for PR #${pr.number}`);
return;
}
const check = await github.rest.checks.create({
owner,
repo,
name: 'verify',
head_sha: headSha,
status: 'in_progress',
output: {
title: 'verify',
summary: 'Running release PR verification checks',
},
});
core.setOutput('should_run', 'true');
core.setOutput('pr_number', String(pr.number));
core.setOutput('check_run_id', String(check.data.id));
- name: Checkout release PR merge ref
if: steps.prep.outputs.should_run == 'true'
uses: actions/checkout@v4
with:
ref: refs/pull/${{ steps.prep.outputs.pr_number }}/merge
- name: Setup Go
if: steps.prep.outputs.should_run == 'true'
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Verify release PR
if: steps.prep.outputs.should_run == 'true'
id: verify
run: |
files=$(go run mvdan.cc/gofumpt@v0.7.0 -l .)
if [ -n "$files" ]; then
echo "$files"
exit 1
fi
go vet ./...
go run honnef.co/go/tools/cmd/staticcheck@v0.6.1 ./...
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8 run
go test ./...
go test -race ./...
go test ./internal/... -coverprofile=coverage.out && go run ./scripts/coveragecheck -min 85 -file coverage.out
go run golang.org/x/vuln/cmd/govulncheck@v1.1.4 ./...
- name: Finalize verify check
if: always() && steps.prep.outputs.should_run == 'true'
uses: actions/github-script@v7
env:
CHECK_RUN_ID: ${{ steps.prep.outputs.check_run_id }}
VERIFY_OUTCOME: ${{ steps.verify.outcome }}
with:
script: |
const { owner, repo } = context.repo;
const checkRunId = Number(process.env.CHECK_RUN_ID);
const success = process.env.VERIFY_OUTCOME === 'success';
await github.rest.checks.update({
owner,
repo,
check_run_id: checkRunId,
status: 'completed',
conclusion: success ? 'success' : 'failure',
output: {
title: 'verify',
summary: success
? 'Release PR verification checks passed.'
: 'Release PR verification checks failed. See workflow logs.',
},
});
finalize-release:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Finalize merged release PR
id: finalize
uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: go
skip-github-pull-request: true
- name: Checkout
if: steps.finalize.outputs.releases_created == 'true' || steps.finalize.outputs.release_created == 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
if: steps.finalize.outputs.releases_created == 'true' || steps.finalize.outputs.release_created == 'true'
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Publish release artifacts
if: steps.finalize.outputs.releases_created == 'true' || steps.finalize.outputs.release_created == 'true'
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}