Skip to content

Commit b226ed5

Browse files
authored
[skip-release] Make release publication recoverable (#38)
* [skip-release] Make release publication recoverable * [skip-release] Remove supported GoReleaser deprecations
1 parent 21ed9fa commit b226ed5

3 files changed

Lines changed: 98 additions & 6 deletions

File tree

.github/workflows/goreleaser.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@ name: goreleaser
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
release-mode:
7+
description: Recovery mode; full is only valid from a new tag ref
8+
required: true
9+
type: choice
10+
default: packages-only
11+
options:
12+
- packages-only
13+
- homebrew-only
14+
- full
15+
release-version:
16+
description: Existing vMAJOR.MINOR.PATCH tag for a recovery mode
17+
required: false
18+
type: string
519
push:
620
tags:
721
- "*"
@@ -12,11 +26,13 @@ permissions:
1226

1327
jobs:
1428
goreleaser:
15-
uses: libops/.github/.github/workflows/sitectl-plugin-goreleaser.yaml@69fc4b92079cd51606e1d4757031c6e9b645bb5a # main
29+
uses: libops/.github/.github/workflows/sitectl-plugin-goreleaser.yaml@66905c983e1ec673e936a7dc4b4d5c2ad0016b49 # main
1630
permissions:
1731
contents: write
1832
id-token: write
1933
secrets: inherit
2034
with:
21-
go-version: "1.26.x"
35+
go-version: "1.26.5"
36+
release-mode: ${{ inputs.release-mode || 'full' }}
37+
release-version: ${{ inputs.release-version }}
2238
package-name: sitectl-drupal
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: release-config
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".goreleaser.yaml"
7+
- ".github/workflows/goreleaser.yaml"
8+
- ".github/workflows/release-config.yaml"
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: release-config-${{ github.event.pull_request.number }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
validate:
19+
runs-on: ubuntu-24.04
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
23+
with:
24+
persist-credentials: false
25+
26+
- name: Install GoReleaser
27+
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6
28+
with:
29+
distribution: goreleaser
30+
version: v2.17.0
31+
install-only: true
32+
33+
- name: Validate release configuration
34+
shell: bash
35+
env:
36+
GORELEASER_DISABLE_SCM_RELEASE: "false"
37+
run: |
38+
set -euo pipefail
39+
40+
set +e
41+
output="$(goreleaser check 2>&1)"
42+
status=$?
43+
set -e
44+
45+
printf '%s\n' "$output"
46+
47+
if [[ "$status" -eq 0 ]]; then
48+
exit 0
49+
fi
50+
51+
if [[ "$status" -ne 2 ]]; then
52+
exit "$status"
53+
fi
54+
55+
plain_output="$(printf '%s\n' "$output" | sed $'s/\033\\[[0-9;]*m//g')"
56+
if ! grep -Fq "configuration is valid, but uses deprecated properties" <<<"$plain_output"; then
57+
echo "GoReleaser did not report a valid deprecated configuration" >&2
58+
exit 1
59+
fi
60+
61+
mapfile -t deprecations < <(grep -F "DEPRECATED:" <<<"$plain_output" || true)
62+
if [[ "${#deprecations[@]}" -ne 1 ]] || [[ "${deprecations[0]}" != *brews* ]]; then
63+
echo "Only the reviewed brews deprecation is allowed" >&2
64+
exit 1
65+
fi

.goreleaser.yaml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
version: 2
2+
release:
3+
disable: "{{ .Env.GORELEASER_DISABLE_SCM_RELEASE }}"
24
before:
35
hooks:
46
- ./scripts/check-sitectl-core-version.sh v0.40.0
@@ -15,7 +17,7 @@ builds:
1517
- darwin
1618

1719
archives:
18-
- format: tar.gz
20+
- formats: [tar.gz]
1921
# this name template makes the OS and Arch compatible with the results of uname.
2022
name_template: >-
2123
{{ .ProjectName }}_
@@ -27,11 +29,11 @@ archives:
2729
# use zip for windows archives
2830
format_overrides:
2931
- goos: windows
30-
format: zip
32+
formats: [zip]
3133
checksum:
3234
name_template: "checksums.txt"
3335
snapshot:
34-
name_template: "{{ incpatch .Version }}-next"
36+
version_template: "{{ incpatch .Version }}-next"
3537
changelog:
3638
sort: asc
3739
filters:
@@ -41,14 +43,23 @@ changelog:
4143
- "^.github"
4244
brews:
4345
- name: sitectl-drupal
46+
description: "A sitectl plugin for Drupal websites"
4447
homepage: "https://github.com/libops/sitectl-drupal"
48+
license: MIT
4549
commit_author:
4650
name: sitectl-dev[bot]
4751
email: 2408410+sitectl-dev[bot]@users.noreply.github.com
4852
repository:
4953
owner: libops
5054
name: homebrew
55+
branch: "{{ .ProjectName }}-{{ .Version }}"
5156
token: "{{ .Env.HOMEBREW_REPO_TOKEN }}"
57+
pull_request:
58+
enabled: true
59+
base:
60+
owner: libops
61+
name: homebrew
62+
branch: main
5263
dependencies:
5364
- name: "libops/homebrew/sitectl"
5465
nfpms:
@@ -65,7 +76,7 @@ nfpms:
6576
- deb
6677
- rpm
6778
mtime: "{{ .CommitDate }}"
68-
builds:
79+
ids:
6980
- sitectl-drupal
7081
dependencies:
7182
- sitectl

0 commit comments

Comments
 (0)