diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7348a6..981a982 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,12 @@ on: pull_request: branches: [ main ] workflow_call: + inputs: + checkout-ref: + description: Git ref to check out when this workflow is called by another workflow. + required: false + type: string + default: '' concurrency: group: ci-${{ github.head_ref || github.run_id }} @@ -17,6 +23,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 + with: + ref: ${{ inputs.checkout-ref || github.ref }} - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6 with: @@ -46,6 +54,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 + with: + ref: ${{ inputs.checkout-ref || github.ref }} - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 39a56e4..2b7e4f6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,12 @@ on: push: tags: - v[0-9].[0-9]+.[0-9]+ + workflow_dispatch: + inputs: + release-tag: + description: Release tag, for example v1.2.3 or v1.2.3-rc1 + required: true + type: string concurrency: group: release-${{ github.head_ref || github.run_id }} @@ -15,15 +21,18 @@ permissions: jobs: ci: uses: ./.github/workflows/ci.yml + with: + checkout-ref: ${{ inputs['release-tag'] || github.ref }} secrets: inherit release: needs: ci runs-on: ubuntu-latest - steps: + steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 with: fetch-depth: 0 + ref: ${{ inputs['release-tag'] || github.ref }} - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6 with: go-version-file: 'go.mod' @@ -31,6 +40,7 @@ jobs: with: distribution: goreleaser version: '~> v2' - args: release --clean + args: release --clean --config .goreleaser.yaml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GORELEASER_CURRENT_TAG: ${{ inputs['release-tag'] || github.ref_name }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 9dadb06..9f65178 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -35,6 +35,9 @@ builds: - -X github.com/arm/remoteproc-runtime/internal/version.Version={{.Version}} - -X github.com/arm/remoteproc-runtime/internal/version.GitCommit={{.Commit}} +release: + prerelease: auto + archives: - formats: [tar.gz] name_template: "remoteproc-runtime_{{ .Version }}_{{ .Os }}_{{ .Arch }}" diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index 9b38caf..1b4d7f0 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -189,7 +189,7 @@ PRs must have semantic commit titles (enforced by GitHub Actions). ### Releases -Releases are automated using GoReleaser when a new tag is pushed: +Releases are automated using GoReleaser when a release tag is pushed: ```bash # Create and push a new version tag @@ -204,3 +204,22 @@ The release workflow will: 1. Build binaries for multiple platforms 1. Create a GitHub release with artifacts + +You can also start the release from GitHub Actions: + +1. Open the **Release** workflow. + +1. Select **Run workflow**. + +1. Enter the release tag, for example `v0.1.0` or `v0.1.0-rc1`. + +To create a pre-release, use an `-rc` tag: + +```bash +git tag v0.1.0-rc1 +git push origin v0.1.0-rc1 +``` + +Then run the **Release** workflow with **release-tag** set to `v0.1.0-rc1`. +GoReleaser marks the GitHub release as a pre-release automatically from the +tag.