Skip to content

Commit a6da53e

Browse files
committed
ci: automate releases with release-please and publish every SDK (#3)
- release-please (release bot App token) keeps a release PR that writes CHANGELOG.md and the version in docs/; merging it pushes vX.Y.Z and a draft release. - release.yml (replaces publish-sdks.yml): GoReleaser fills and publishes the draft with the plugin and schema.json, tags the Go SDK, then builds and publishes npm (token for the first publish, then trusted publishing), PyPI (trusted publishing) and NuGet (trusted publishing or API key) from the npm, pypi and nuget environments, with provenance. Each registry skips with a warning until it is set up. - CI: GoReleaser snapshot of the six plugin archives and Pulumi Registry docs checks, next to the existing schema/SDK drift check and tests. - docs: add installation-configuration.md; the HCL example uses the pulumi/noderings source with an exact version. - Dependabot: weekly, Conventional Commit prefixes. - CONTRIBUTING: document the release flow and one-time registry setup. The release bot secret and variable are set on the repository, and the environments npm, pypi and nuget exist (v* tags only). No registry credentials are configured yet, so the publish jobs will skip with a warning until they are. Signed-off-by: NodeRings <17057583+shaygun@users.noreply.github.com>
1 parent 533c1b3 commit a6da53e

11 files changed

Lines changed: 622 additions & 127 deletions

‎.github/dependabot.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
# Commit messages use Conventional Commits so release-please can sort them:
2+
# "deps" updates (Go modules built into the provider) show up in the
3+
# changelog, "ci" updates (GitHub Actions) do not.
14
version: 2
25
updates:
36
- package-ecosystem: "github-actions"
47
directory: "/"
58
schedule:
69
interval: "weekly"
10+
day: "monday"
11+
time: "09:00"
12+
timezone: "Etc/UTC"
13+
commit-message:
14+
prefix: "ci"
715
groups:
816
"github-actions":
917
patterns:
@@ -12,6 +20,11 @@ updates:
1220
directory: "/provider"
1321
schedule:
1422
interval: "weekly"
23+
day: "monday"
24+
time: "09:00"
25+
timezone: "Etc/UTC"
26+
commit-message:
27+
prefix: "deps"
1528
groups:
1629
"gomod":
1730
patterns:

‎.github/workflows/ci.yml‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,42 @@ jobs:
7777
sdk/nodejs/bin
7878
sdk/python/bin
7979
80+
release-config:
81+
name: Release config and docs
82+
runs-on: ubuntu-latest
83+
timeout-minutes: 20
84+
steps:
85+
- uses: actions/checkout@v7
86+
with:
87+
fetch-depth: 0
88+
- uses: actions/setup-go@v7
89+
with:
90+
go-version-file: provider/go.mod
91+
cache-dependency-path: provider/go.sum
92+
- name: Build the plugin archives (snapshot, nothing published)
93+
uses: goreleaser/goreleaser-action@v7
94+
with:
95+
version: "~> v2"
96+
args: release --snapshot --clean --skip=publish
97+
- name: Check the plugin archives
98+
run: |
99+
# Pulumi downloads pulumi-resource-noderings-v<version>-<os>-<arch>.tar.gz
100+
for p in linux-amd64 linux-arm64 darwin-amd64 darwin-arm64 windows-amd64 windows-arm64; do
101+
ls dist/pulumi-resource-noderings-v*-"${p}".tar.gz
102+
done
103+
- name: Check the Pulumi Registry docs
104+
run: |
105+
# The Registry needs YAML front matter with title, meta_desc and layout: package.
106+
for f in docs/_index.md docs/installation-configuration.md; do
107+
head -1 "$f" | grep -qx -- '---' || { echo "::error file=$f::missing front matter"; exit 1; }
108+
for k in title meta_desc layout; do
109+
sed -n '2,/^---$/p' "$f" | grep -q "^${k}: " || { echo "::error file=$f::front matter lacks ${k}"; exit 1; }
110+
done
111+
done
112+
grep -q '"displayName": "NodeRings"' provider/cmd/pulumi-resource-noderings/schema.json
113+
python3 -c "import json,sys; d=json.load(open('provider/cmd/pulumi-resource-noderings/schema.json')); sys.exit('schema.json must not set version' if 'version' in d else 0)"
114+
python3 -c "import json; json.load(open('release-please-config.json')); json.load(open('.release-please-manifest.json'))"
115+
80116
integration:
81117
name: Integration tests (live API)
82118
needs: build

‎.github/workflows/publish-sdks.yml‎

Lines changed: 0 additions & 112 deletions
This file was deleted.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: release-please
2+
3+
# Keeps one open release pull request that collects the Conventional Commits
4+
# merged since the last release into CHANGELOG.md and picks the next version.
5+
# Merging it pushes the vX.Y.Z tag and a draft GitHub release; the tag starts
6+
# release.yml, which uploads the provider plugin to that release, publishes it,
7+
# tags the Go SDK and publishes the npm, PyPI and NuGet SDKs. The Pulumi
8+
# Registry picks the published release up from there.
9+
#
10+
# Needs the organization's release bot GitHub App, because tags and pull
11+
# requests made with the workflow's own GITHUB_TOKEN do not start other
12+
# workflows:
13+
# variable RELEASE_BOT_APP_ID (or RELEASE_BOT_CLIENT_ID) and
14+
# secret RELEASE_BOT_PRIVATE_KEY.
15+
"on":
16+
push:
17+
branches: [main]
18+
workflow_dispatch:
19+
20+
permissions:
21+
contents: read
22+
23+
concurrency:
24+
group: release-please
25+
cancel-in-progress: false
26+
27+
jobs:
28+
release-please:
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 10
31+
steps:
32+
- name: Check the release bot is set up
33+
id: bot
34+
env:
35+
APP_ID: ${{ vars.RELEASE_BOT_APP_ID }}
36+
CLIENT_ID: ${{ vars.RELEASE_BOT_CLIENT_ID }}
37+
HAS_KEY: ${{ secrets.RELEASE_BOT_PRIVATE_KEY != '' }}
38+
run: |
39+
if { [ -n "${APP_ID}" ] || [ -n "${CLIENT_ID}" ]; } && [ "${HAS_KEY}" = "true" ]; then
40+
echo "ready=true" >> "$GITHUB_OUTPUT"
41+
else
42+
echo "::warning title=release-please skipped::Set the variable RELEASE_BOT_APP_ID and secret RELEASE_BOT_PRIVATE_KEY (see CONTRIBUTING.md, Releasing)."
43+
echo "ready=false" >> "$GITHUB_OUTPUT"
44+
fi
45+
- uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
46+
if: steps.bot.outputs.ready == 'true'
47+
id: app
48+
with:
49+
# GitHub accepts either the App ID or the Client ID here.
50+
client-id: ${{ vars.RELEASE_BOT_CLIENT_ID || vars.RELEASE_BOT_APP_ID }}
51+
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
52+
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
53+
if: steps.bot.outputs.ready == 'true'
54+
with:
55+
token: ${{ steps.app.outputs.token }}
56+
config-file: release-please-config.json
57+
manifest-file: .release-please-manifest.json

0 commit comments

Comments
 (0)