Skip to content
This repository was archived by the owner on Sep 12, 2023. It is now read-only.

Commit b2eb2c1

Browse files
committed
add release workflow
1 parent 79ca2e2 commit b2eb2c1

File tree

2 files changed

+387
-0
lines changed

2 files changed

+387
-0
lines changed

.github/workflows/release .yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: release
2+
3+
permissions:
4+
contents: write
5+
6+
"on":
7+
push:
8+
tags:
9+
- v*.*.*
10+
- '!v*.*.*-**'
11+
12+
env:
13+
OVH_ENDPOINT: "ovh-us"
14+
OVH_APPLICATION_KEY: ${{ secrets.OVH_APPLICATION_KEY }}
15+
OVH_APPLICATION_SECRET: ${{ secrets.OVH_APPLICATION_SECRET }}
16+
OVH_CONSUMER_KEY: ${{ secrets.OVH_CONSUMER_KEY }}
17+
18+
jobs:
19+
main:
20+
#uses: jaxxstorm/workflows/.github/workflows/main.yml@df55f0116159ea8d30f836557f05a3c699a37a63
21+
uses: ./.github/workflows/release-reusable.yml
22+
secrets: inherit
23+
with:
24+
pulumi_test_owner: "lbrlabs"
25+
provider_name: "ovh"
26+
Lines changed: 361 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,361 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
pulumi_test_owner:
5+
required: true
6+
type: string
7+
provider_name:
8+
required: true
9+
type: string
10+
env:
11+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
14+
NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }}
15+
PROVIDER: ${{ inputs.provider_name }}
16+
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
17+
PULUMI_API: https://api.pulumi.com
18+
PULUMI_GO_DEP_ROOT: ${{ github.workspace }}/..
19+
PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget
20+
PULUMI_TEST_OWNER: ${{ inputs.pulumi_test_owner }}
21+
PYPI_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
22+
PYPI_USERNAME: "__token__"
23+
TRAVIS_OS_NAME: linux
24+
25+
jobs:
26+
build_sdk:
27+
name: build_sdk
28+
needs: prerequisites
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout Repo
32+
uses: actions/checkout@v2
33+
- name: Checkout Scripts Repo
34+
uses: actions/checkout@v2
35+
with:
36+
path: ci-scripts
37+
repository: jaxxstorm/scripts
38+
ref: third_party
39+
- name: Unshallow clone for tags
40+
run: git fetch --prune --unshallow --tags
41+
- name: Install Go
42+
uses: actions/setup-go@v2
43+
with:
44+
go-version: ${{matrix.goversion}}
45+
- name: Install pulumictl
46+
uses: jaxxstorm/action-install-gh-release@v1.2.0
47+
with:
48+
repo: pulumi/pulumictl
49+
- name: Install Pulumi CLI
50+
uses: pulumi/action-install-pulumi-cli@v2
51+
- name: Setup Node
52+
uses: actions/setup-node@v2
53+
with:
54+
node-version: ${{matrix.nodeversion}}
55+
registry-url: https://registry.npmjs.org
56+
- name: Setup DotNet
57+
uses: actions/setup-dotnet@v1
58+
with:
59+
dotnet-version: ${{matrix.dotnetversion}}
60+
- name: Setup Python
61+
uses: actions/setup-python@v2
62+
with:
63+
python-version: ${{matrix.pythonversion}}
64+
- name: Download provider + tfgen binaries
65+
uses: actions/download-artifact@v2
66+
with:
67+
name: ${{ env.PROVIDER }}-provider.tar.gz
68+
path: ${{ github.workspace }}/bin
69+
- name: Untar provider binaries
70+
run: |-
71+
tar -zxf ${{ github.workspace }}/bin/provider.tar.gz -C ${{ github.workspace}}/bin
72+
find ${{ github.workspace }} -name "pulumi-*-${{ env.PROVIDER }}" -print -exec chmod +x {} \;
73+
- name: Install plugins
74+
run: make install_plugins
75+
- name: Update path
76+
run: echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
77+
- name: Build SDK
78+
run: make build_${{ matrix.language }}
79+
- name: Check worktree clean
80+
run: ./ci-scripts/ci/check-worktree-is-clean
81+
- name: Compress SDK folder
82+
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
83+
- name: Upload artifacts
84+
uses: actions/upload-artifact@v2
85+
with:
86+
name: ${{ matrix.language }}-sdk.tar.gz
87+
path: ${{ github.workspace}}/sdk/${{ matrix.language }}.tar.gz
88+
strategy:
89+
fail-fast: true
90+
matrix:
91+
dotnetversion:
92+
- 3.1.301
93+
goversion:
94+
- 1.19.x
95+
language:
96+
- nodejs
97+
- python
98+
- dotnet
99+
- go
100+
nodeversion:
101+
- 14.x
102+
pythonversion:
103+
- "3.7"
104+
prerequisites:
105+
name: prerequisites
106+
runs-on: ubuntu-latest
107+
steps:
108+
- name: Checkout Repo
109+
uses: actions/checkout@v2
110+
- name: Checkout Scripts Repo
111+
uses: actions/checkout@v2
112+
with:
113+
path: ci-scripts
114+
repository: jaxxstorm/scripts
115+
ref: third_party
116+
- name: Unshallow clone for tags
117+
run: git fetch --prune --unshallow --tags
118+
- name: Install Go
119+
uses: actions/setup-go@v2
120+
with:
121+
go-version: ${{matrix.goversion}}
122+
- name: Install pulumictl
123+
uses: jaxxstorm/action-install-gh-release@v1.2.0
124+
with:
125+
repo: pulumi/pulumictl
126+
- name: Install Pulumi CLI
127+
uses: pulumi/action-install-pulumi-cli@v2
128+
- if: github.event_name == 'pull_request'
129+
name: Install Schema Tools
130+
uses: jaxxstorm/action-install-gh-release@v1.2.0
131+
with:
132+
repo: mikhailshilkov/schema-tools
133+
- name: Build tfgen & provider binaries
134+
run: make provider
135+
# - if: github.event_name == 'pull_request'
136+
# name: Check Schema is Valid
137+
# run: |-
138+
# echo 'SCHEMA_CHANGES<<EOF' >> $GITHUB_ENV
139+
# schema-tools compare ${{ env.PROVIDER }} master --local-path=provider/cmd/pulumi-resource-${{ env.PROVIDER }}/schema.json >> $GITHUB_ENV
140+
# echo 'EOF' >> $GITHUB_ENV
141+
# - if: github.event_name == 'pull_request'
142+
# name: Comment on PR with Details of Schema Check
143+
# uses: thollander/actions-comment-pull-request@1.0.1
144+
# with:
145+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146+
# message: |
147+
# ### Does the PR have any schema changes?
148+
149+
# ${{ env.SCHEMA_CHANGES }}
150+
- name: Tar provider binaries
151+
run: tar -zcf ${{ github.workspace }}/bin/provider.tar.gz -C ${{ github.workspace }}/bin/ pulumi-resource-${{ env.PROVIDER }} pulumi-tfgen-${{ env.PROVIDER }}
152+
- name: Upload artifacts
153+
uses: actions/upload-artifact@v2
154+
with:
155+
name: ${{ env.PROVIDER }}-provider.tar.gz
156+
path: ${{ github.workspace }}/bin/provider.tar.gz
157+
strategy:
158+
fail-fast: true
159+
matrix:
160+
dotnetversion:
161+
- 3.1.301
162+
goversion:
163+
- 1.19.x
164+
nodeversion:
165+
- 14.x
166+
pythonversion:
167+
- "3.7"
168+
publish:
169+
name: publish
170+
needs: test
171+
runs-on: ubuntu-latest
172+
steps:
173+
- name: Checkout Repo
174+
uses: actions/checkout@v2
175+
- name: Unshallow clone for tags
176+
run: git fetch --prune --unshallow --tags
177+
- name: Install Go
178+
uses: actions/setup-go@v2
179+
with:
180+
go-version: ${{matrix.goversion}}
181+
- name: Install pulumictl
182+
uses: jaxxstorm/action-install-gh-release@v1.2.0
183+
with:
184+
repo: pulumi/pulumictl
185+
- name: Install Pulumi CLI
186+
uses: pulumi/action-install-pulumi-cli@v2
187+
- name: Set Release Version
188+
run: echo "GORELEASER_CURRENT_TAG=v$(pulumictl get version --language generic)" >> $GITHUB_ENV
189+
- name: Run GoReleaser
190+
uses: goreleaser/goreleaser-action@v2
191+
with:
192+
args: release --rm-dist --timeout 60m0s
193+
version: latest
194+
strategy:
195+
fail-fast: true
196+
matrix:
197+
dotnetversion:
198+
- 3.1.301
199+
goversion:
200+
- 1.19.x
201+
nodeversion:
202+
- 14.x
203+
pythonversion:
204+
- "3.7"
205+
publish_sdk:
206+
name: publish_sdk
207+
needs: publish
208+
runs-on: ubuntu-latest
209+
steps:
210+
- name: Checkout Repo
211+
uses: actions/checkout@v2
212+
- name: Checkout Scripts Repo
213+
uses: actions/checkout@v2
214+
with:
215+
path: ci-scripts
216+
repository: jaxxstorm/scripts
217+
ref: third_party
218+
- name: Unshallow clone for tags
219+
run: git fetch --prune --unshallow --tags
220+
- name: Install Go
221+
uses: actions/setup-go@v2
222+
with:
223+
go-version: ${{matrix.goversion}}
224+
- name: Install pulumictl
225+
uses: jaxxstorm/action-install-gh-release@v1.2.0
226+
with:
227+
repo: pulumi/pulumictl
228+
- name: Install Pulumi CLI
229+
uses: pulumi/action-install-pulumi-cli@v2
230+
- name: Setup Node
231+
uses: actions/setup-node@v2
232+
with:
233+
node-version: ${{matrix.nodeversion}}
234+
registry-url: https://registry.npmjs.org
235+
- name: Setup DotNet
236+
uses: actions/setup-dotnet@v1
237+
with:
238+
dotnet-version: ${{matrix.dotnetversion}}
239+
- name: Setup Python
240+
uses: actions/setup-python@v2
241+
with:
242+
python-version: ${{matrix.pythonversion}}
243+
- name: Download python SDK
244+
uses: actions/download-artifact@v2
245+
with:
246+
name: python-sdk.tar.gz
247+
path: ${{ github.workspace}}/sdk/
248+
- name: Uncompress python SDK
249+
run: tar -zxf ${{github.workspace}}/sdk/python.tar.gz -C ${{github.workspace}}/sdk/python
250+
- name: Download dotnet SDK
251+
uses: actions/download-artifact@v2
252+
with:
253+
name: dotnet-sdk.tar.gz
254+
path: ${{ github.workspace}}/sdk/
255+
- name: Uncompress dotnet SDK
256+
run: tar -zxf ${{github.workspace}}/sdk/dotnet.tar.gz -C ${{github.workspace}}/sdk/dotnet
257+
- name: Download nodejs SDK
258+
uses: actions/download-artifact@v2
259+
with:
260+
name: nodejs-sdk.tar.gz
261+
path: ${{ github.workspace}}/sdk/
262+
- name: Uncompress nodejs SDK
263+
run: tar -zxf ${{github.workspace}}/sdk/nodejs.tar.gz -C ${{github.workspace}}/sdk/nodejs
264+
- run: python -m pip install pip twine
265+
- env:
266+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
267+
name: Publish SDKs
268+
run: ./ci-scripts/ci/publish-tfgen-package ${{ github.workspace }}
269+
strategy:
270+
fail-fast: true
271+
matrix:
272+
dotnetversion:
273+
- 3.1.301
274+
goversion:
275+
- 1.19.x
276+
nodeversion:
277+
- 14.x
278+
pythonversion:
279+
- "3.7"
280+
test:
281+
name: test
282+
needs: build_sdk
283+
runs-on: ubuntu-latest
284+
steps:
285+
- name: Checkout Repo
286+
uses: actions/checkout@v2
287+
- name: Checkout Scripts Repo
288+
uses: actions/checkout@v2
289+
with:
290+
path: ci-scripts
291+
repository: jaxxstorm/scripts
292+
ref: third_party
293+
- name: Unshallow clone for tags
294+
run: git fetch --prune --unshallow --tags
295+
- name: Install Go
296+
uses: actions/setup-go@v2
297+
with:
298+
go-version: ${{matrix.goversion}}
299+
- name: Install pulumictl
300+
uses: jaxxstorm/action-install-gh-release@v1.2.0
301+
with:
302+
repo: pulumi/pulumictl
303+
- name: Install Pulumi CLI
304+
uses: pulumi/action-install-pulumi-cli@v2
305+
- name: Setup Node
306+
uses: actions/setup-node@v2
307+
with:
308+
node-version: ${{matrix.nodeversion}}
309+
registry-url: https://registry.npmjs.org
310+
- name: Setup DotNet
311+
uses: actions/setup-dotnet@v1
312+
with:
313+
dotnet-version: ${{matrix.dotnetversion}}
314+
- name: Setup Python
315+
uses: actions/setup-python@v2
316+
with:
317+
python-version: ${{matrix.pythonversion}}
318+
- name: Download provider + tfgen binaries
319+
uses: actions/download-artifact@v2
320+
with:
321+
name: ${{ env.PROVIDER }}-provider.tar.gz
322+
path: ${{ github.workspace }}/bin
323+
- name: Untar provider binaries
324+
run: |-
325+
tar -zxf ${{ github.workspace }}/bin/provider.tar.gz -C ${{ github.workspace}}/bin
326+
find ${{ github.workspace }} -name "pulumi-*-${{ env.PROVIDER }}" -print -exec chmod +x {} \;
327+
- run: dotnet nuget add source ${{ github.workspace }}/nuget
328+
- name: Download SDK
329+
uses: actions/download-artifact@v2
330+
with:
331+
name: ${{ matrix.language }}-sdk.tar.gz
332+
path: ${{ github.workspace}}/sdk/
333+
- name: Uncompress SDK folder
334+
run: tar -zxf ${{ github.workspace }}/sdk/${{ matrix.language }}.tar.gz -C ${{
335+
github.workspace }}/sdk/${{ matrix.language }}
336+
- name: Update path
337+
run: echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
338+
- name: Install Python deps
339+
run: |-
340+
pip3 install virtualenv==20.0.23
341+
pip3 install pipenv
342+
- name: Install dependencies
343+
run: make install_${{ matrix.language}}_sdk
344+
- name: Run tests
345+
run: cd examples && go test -v -count=1 -cover -timeout 2h -tags=${{ matrix.language}} -parallel 4 .
346+
strategy:
347+
fail-fast: true
348+
matrix:
349+
dotnetversion:
350+
- 3.1.301
351+
goversion:
352+
- 1.19.x
353+
language:
354+
- nodejs
355+
- python
356+
- dotnet
357+
- go
358+
nodeversion:
359+
- 14.x
360+
pythonversion:
361+
- "3.7"

0 commit comments

Comments
 (0)