Skip to content

Commit 68f0eac

Browse files
committed
test
1 parent b2b5e5d commit 68f0eac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+73
-12113
lines changed

.github/workflows/release.yml

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ on:
77

88
permissions:
99
contents: write
10+
# Required for OIDC authentication with PyPI
11+
id-token: write
1012

1113
jobs:
1214
release:
1315
name: Create Release
1416
runs-on: ubuntu-latest
17+
outputs:
18+
version: ${{ steps.version.outputs.VERSION }}
1519

1620
steps:
1721
- name: Checkout code
@@ -25,6 +29,13 @@ jobs:
2529
go-version: '1.24'
2630
cache-dependency-path: provider/go.sum
2731

32+
- name: Install pulumictl
33+
run: |
34+
PULUMICTL_VERSION=v0.0.50
35+
curl -fsSL https://github.com/pulumi/pulumictl/releases/download/${PULUMICTL_VERSION}/pulumictl-${PULUMICTL_VERSION}-linux-amd64.tar.gz | tar -xz
36+
sudo mv pulumictl /usr/local/bin/
37+
pulumictl version
38+
2839
- name: Get version
2940
id: version
3041
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
@@ -39,8 +50,7 @@ jobs:
3950
- name: Create Release
4051
uses: softprops/action-gh-release@v1
4152
with:
42-
files: |
43-
bin/pulumi-resource-clevercloud-${{ steps.version.outputs.VERSION }}-linux-amd64.tar.gz
53+
files: bin/pulumi-resource-clevercloud-${{ steps.version.outputs.VERSION }}-linux-amd64.tar.gz
4454
generate_release_notes: true
4555
draft: false
4656
prerelease: ${{ contains(steps.version.outputs.VERSION, '-') }}
@@ -49,15 +59,12 @@ jobs:
4959
name: Publish SDKs
5060
needs: release
5161
runs-on: ubuntu-latest
52-
permissions:
53-
contents: read
54-
# Required for OIDC authentication with PyPI
55-
id-token: write
5662

5763
steps:
5864
- name: Checkout code
5965
uses: actions/checkout@v4
6066
with:
67+
ref: ${{ needs.release.outputs.version }}
6168
fetch-depth: 0
6269

6370
- name: Set up Go
@@ -69,22 +76,32 @@ jobs:
6976
- name: Set up Node.js
7077
uses: actions/setup-node@v4
7178
with:
72-
node-version: '20'
79+
node-version: '24'
7380
registry-url: 'https://registry.npmjs.org'
7481

7582
- name: Set up Python
7683
uses: actions/setup-python@v5
7784
with:
7885
python-version: '3.12'
7986

87+
- name: Install pulumictl
88+
run: |
89+
PULUMICTL_VERSION=v0.0.50
90+
curl -fsSL https://github.com/pulumi/pulumictl/releases/download/${PULUMICTL_VERSION}/pulumictl-${PULUMICTL_VERSION}-linux-amd64.tar.gz | tar -xz
91+
sudo mv pulumictl /usr/local/bin/
92+
pulumictl version
93+
94+
- name: Install Python build tools
95+
run: pip install build
96+
8097
- name: Set up .NET
8198
uses: actions/setup-dotnet@v4
8299
with:
83-
dotnet-version: '8.0'
100+
dotnet-version: '10.0'
84101

85102
- name: Install pulumictl
86103
run: |
87-
PULUMICTL_VERSION=v0.0.46
104+
PULUMICTL_VERSION=v0.0.50
88105
curl -fsSL https://github.com/pulumi/pulumictl/releases/download/${PULUMICTL_VERSION}/pulumictl-${PULUMICTL_VERSION}-linux-amd64.tar.gz | tar -xz
89106
sudo mv pulumictl /usr/local/bin/
90107
pulumictl version
@@ -94,21 +111,28 @@ jobs:
94111

95112
- name: Publish to npm
96113
working-directory: sdk/nodejs
97-
run: npm publish
98-
99-
- name: Build Python package
100-
working-directory: sdk/python
101-
run: |
102-
pip install build
103-
python -m build
114+
run: npm publish --access public --verbose
104115

105116
- name: Publish to PyPI
106117
uses: pypa/gh-action-pypi-publish@release/v1
107118
with:
108119
packages-dir: sdk/python/dist/
120+
env:
121+
name: pypi
122+
url: https://pypi.org/p/pulumi-clevercloud
123+
124+
# Get a short-lived NuGet API key
125+
# https://learn.microsoft.com/en-us/nuget/nuget-org/trusted-publishing
126+
- name: NuGet login (OIDC → temp API key)
127+
uses: NuGet/login@v1
128+
id: login
129+
with:
130+
user: "${{ secrets.NUGET_USER }}"
109131

110132
- name: Publish to NuGet
111133
working-directory: sdk/dotnet
112134
run: |
113-
dotnet pack
114-
dotnet nuget push bin/Release/*.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json
135+
dotnet nuget push bin/Release/*.nupkg \
136+
--skip-duplicate \
137+
--api-key ${{steps.login.outputs.NUGET_API_KEY}} \
138+
--source https://api.nuget.org/v3/index.json

.gitignore

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,7 @@ Pulumi.*.yaml
2424
schema.json
2525

2626
# Build artifacts
27-
sdk/nodejs/bin/
28-
sdk/python/build/
29-
sdk/python/dist/
30-
sdk/python/*.egg-info/
31-
sdk/dotnet/bin/
32-
sdk/dotnet/obj/
33-
sdk/go/clevercloud/
34-
sdk/java/target/
27+
sdk/
3528

3629
# Logs
3730
*.log

Makefile

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
PROJECT_NAME := clevercloud
2-
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "v0.0.1-dev")
2+
VERSION ?= $(shell git describe --tags --always 2>/dev/null || echo "v0.0.1-dev")
3+
VERSION_DOTNET := $(shell pulumictl convert-version --language dotnet --version "$(VERSION)")
4+
VERSION_JS := $(shell pulumictl convert-version --language javascript --version "$(VERSION)")
5+
VERSION_PYTHON := $(shell pulumictl convert-version --language python --version "$(VERSION)")
36
PROVIDER_PATH := provider
47
WORKING_DIR := $(shell pwd)
58
PROVIDER_BIN := pulumi-resource-$(PROJECT_NAME)
@@ -14,6 +17,7 @@ deps:
1417

1518
.PHONY: build_provider
1619
build_provider:
20+
@echo "building version ${VERSION}"
1721
cd $(PROVIDER_PATH) && go build \
1822
-mod=mod \
1923
-o $(WORKING_DIR)/bin/$(PROVIDER_BIN) \
@@ -29,18 +33,18 @@ check_tools:
2933

3034
.PHONY: build_sdks
3135
build_sdks: build_provider
32-
@echo "Generating SDKs..."
33-
pulumi package gen-sdk $(WORKING_DIR)/bin/$(PROVIDER_BIN)
34-
@echo "Updating SDK versions and metadata..."
35-
VERSION_JS=$$(command -v pulumictl >/dev/null 2>&1 && pulumictl get version --language javascript || echo "$(VERSION:v%=%)")
36-
VERSION_PY=$$(command -v pulumictl >/dev/null 2>&1 && pulumictl get version --language python || echo "$(VERSION:v%=%)")
37-
jq \
38-
--arg version "$$VERSION_JS" '.version = $$version | .main = "bin/index.js" | .types = "bin/index.d.ts" | .publishConfig = {"access": "public"}' \
39-
sdk/nodejs/package.json > sdk/nodejs/package.json.tmp
40-
mv sdk/nodejs/package.json.tmp sdk/nodejs/package.json
41-
sed -i "s|require('./package.json')|require('../package.json')|g" sdk/nodejs/utilities.ts
42-
cd sdk/nodejs && npm install && npm run build
43-
sed -i "s/version = \".*\"/version = \"$$VERSION_PY\"/g" sdk/python/setup.py 2>/dev/null || true
36+
@echo "Generating SDKs (${VERSION})..."
37+
pulumi package gen-sdk -e --color always --language nodejs $(WORKING_DIR)/bin/$(PROVIDER_BIN)
38+
pulumi package gen-sdk -e --color always --language python $(WORKING_DIR)/bin/$(PROVIDER_BIN)
39+
pulumi package gen-sdk -e --color always --language dotnet $(WORKING_DIR)/bin/$(PROVIDER_BIN)
40+
cd sdk/nodejs && npm pkg set version="$(VERSION_JS)"
41+
@echo "$(VERSION_DOTNET)" > sdk/dotnet/version.txt
42+
@sed -i 's/VERSION = "0.0.0"/VERSION = "$(VERSION_PYTHON)"/' sdk/python/setup.py
43+
cd sdk/nodejs && npm install && npm run build && npm pkg fix
44+
cd sdk/python && python3 -m build
45+
cd sdk/dotnet && dotnet build -c Release && dotnet pack -c Release --no-build --version ${VERSION_DOTNET}
46+
@cp sdk/nodejs/package.json sdk/nodejs/bin/package.json
47+
4448

4549
.PHONY: install
4650
install: build
@@ -84,14 +88,13 @@ lint:
8488

8589
.PHONY: clean
8690
clean:
87-
rm -rf bin/
88-
rm -rf sdk/dotnet/bin sdk/dotnet/obj
89-
rm -rf sdk/nodejs/bin
90-
rm -rf sdk/python/build
91+
rm -rf bin/*
92+
rm -rf sdk
93+
rm schema.json
9194

9295
.PHONY: generate_schema
9396
generate_schema: build_provider
94-
$(WORKING_DIR)/bin/$(PROVIDER_BIN) schema > $(SCHEMA_PATH)
97+
pulumi package get-schema $(WORKING_DIR)/bin/$(PROVIDER_BIN) > $(SCHEMA_PATH)
9598

9699
.PHONY: dev
97100
dev: build install

0 commit comments

Comments
 (0)