Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 39 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,20 @@ name: Release
on:
push:
tags:
- "v*"
- "v[0-9]*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release (must already be pushed, e.g. v5.10.0-rc1)"
required: true
upload_taps:
description: "Upload to Homebrew/Scoop taps (overrides pre-release skip)"
type: boolean
default: false
upload_repos:
description: "Upload to package repositories via repogen (overrides pre-release skip)"
type: boolean
default: false

permissions:
contents: write
Expand All @@ -14,9 +27,25 @@ jobs:
environment: production

steps:
- name: Resolve tag
id: tag
run: |
TAG="${{ inputs.tag || github.ref_name }}"
if ! echo "$TAG" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$'; then
echo "::error::Tag '$TAG' does not match semver format (vMAJOR.MINOR.PATCH)"
exit 1
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
if [[ "$TAG" == *-* ]]; then
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
fi

- name: Check out repository code
uses: actions/checkout@v4
with:
ref: ${{ steps.tag.outputs.tag }}
fetch-depth: 0

- name: Setup Go
Expand Down Expand Up @@ -86,30 +115,37 @@ jobs:
- name: Install Go tools
run: make goreleaser repogen

- name: Override tap skip_upload
if: inputs.upload_taps == true
run: "sed -i 's/skip_upload: auto/skip_upload: false/' .goreleaser.yaml"

- name: Build release (tag)
if: startsWith(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/') || inputs.tag
env:
GORELEASER_CURRENT_TAG: ${{ steps.tag.outputs.tag }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RSA_SIGNING_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/rsa-signing-key.pem
GPG_SIGNING_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/gpg-signing-key.asc
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
run: make release

- name: Build snapshot (branch)
if: "!startsWith(github.ref, 'refs/tags/')"
if: "!startsWith(github.ref, 'refs/tags/') && !inputs.tag"
env:
RSA_SIGNING_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/rsa-signing-key.pem
GPG_SIGNING_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/gpg-signing-key.asc
run: make snapshot

- name: Configure AWS credentials
if: steps.tag.outputs.is_prerelease == 'false' || inputs.upload_repos == true
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1

- name: Upload packages to repository
if: steps.tag.outputs.is_prerelease == 'false' || inputs.upload_repos == true
env:
GPG_PRIVATE_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/gpg-signing-key.asc
RSA_PRIVATE_KEY_FILE: ${{ steps.signing-keys.outputs.key_dir }}/rsa-signing-key.pem
Expand Down
5 changes: 5 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ release:
github:
owner: upsun
name: cli
prerelease: auto
footer: |
## Upgrade

Expand Down Expand Up @@ -146,6 +147,7 @@ archives:

brews:
- name: platformsh-cli
skip_upload: auto
repository:
owner: upsun
name: homebrew-tap
Expand Down Expand Up @@ -176,6 +178,7 @@ brews:
system "#{bin}/platform --version"

- name: upsun-cli
skip_upload: auto
repository:
owner: upsun
name: homebrew-tap
Expand Down Expand Up @@ -207,6 +210,7 @@ brews:

scoops:
- name: platform
skip_upload: auto
repository:
owner: upsun
name: homebrew-tap
Expand All @@ -228,6 +232,7 @@ scoops:
- extras/vcredist2022

- name: upsun
skip_upload: auto
repository:
owner: upsun
name: homebrew-tap
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ ifndef GPG_SIGNING_KEY_FILE
$(error GPG_SIGNING_KEY_FILE is not set. Set it to the path of your GPG private key for RPM signing.)
endif
PHP_VERSION=$(PHP_VERSION) goreleaser release --clean
VERSION=$(VERSION) bash cloudsmith.sh
@if echo "$(VERSION)" | grep -qv -- '-'; then \
VERSION=$(VERSION) bash cloudsmith.sh; \
else \
echo "Skipping Cloudsmith upload for pre-release version $(VERSION)"; \
fi

.PHONY: test
# "We encourage users of encoding/json to test their programs with GOEXPERIMENT=jsonv2 enabled" (https://tip.golang.org/doc/go1.25)
Expand Down
Loading