Skip to content

Commit ac453d6

Browse files
committed
Merge branch 'feat/sdk-publish' into 'main'
Build and publish multi language SDK.
2 parents 1629801 + 3177188 commit ac453d6

1 file changed

Lines changed: 82 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ env:
3434
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
3535
PYPI_USERNAME: "__token__"
3636
PYPI_REPOSITORY_URL: ""
37-
PUBLISH_PYPI: false
37+
PUBLISH_PYPI: true
3838
permissions:
3939
contents: write
4040
jobs:
@@ -68,4 +68,84 @@ jobs:
6868
env:
6969
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
7070
# GitHub sets this automatically
71-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
publish_sdk:
73+
name: Publish SDKs
74+
runs-on: ubuntu-latest
75+
needs: publish_binary
76+
steps:
77+
- name: Checkout Repo
78+
uses: actions/checkout@v2
79+
- name: Unshallow clone for tags
80+
run: git fetch --prune --unshallow --tags
81+
- name: Install Go
82+
uses: actions/setup-go@v2
83+
with:
84+
go-version: ${{ matrix.goversion }}
85+
- name: Install pulumictl
86+
uses: jaxxstorm/action-install-gh-release@v1.5.0
87+
with:
88+
repo: pulumi/pulumictl
89+
tag: v0.0.32
90+
- name: Install Pulumi CLI
91+
uses: pulumi/action-install-pulumi-cli@v2.0.0
92+
with:
93+
pulumi-version: 3.47.1
94+
- name: Setup Node
95+
uses: actions/setup-node@v1
96+
with:
97+
node-version: ${{ matrix.nodeversion }}
98+
registry-url: ${{ env.NPM_REGISTRY_URL }}
99+
- name: Setup DotNet
100+
uses: actions/setup-dotnet@v1
101+
with:
102+
dotnet-version: ${{ matrix.dotnetverson }}
103+
- name: Setup Python
104+
uses: actions/setup-python@v1
105+
with:
106+
python-version: ${{ matrix.pythonversion }}
107+
- name: Build SDK
108+
run: make build_${{ matrix.language }}
109+
- name: Check worktree clean
110+
run: |
111+
git update-index -q --refresh
112+
if ! git diff-files --quiet; then
113+
>&2 echo "error: working tree is not clean, aborting!"
114+
git status
115+
git diff
116+
exit 1
117+
fi
118+
- if: ${{ matrix.language == 'python' && env.PUBLISH_PYPI == 'true' }}
119+
name: Publish package to PyPI
120+
uses: pypa/gh-action-pypi-publish@release/v1
121+
with:
122+
user: ${{ env.PYPI_USERNAME }}
123+
password: ${{ env.PYPI_PASSWORD }}
124+
packages_dir: ${{ github.workspace }}/sdk/python/bin/dist
125+
- if: ${{ matrix.language == 'nodejs' && env.PUBLISH_NPM == 'true' }}
126+
uses: JS-DevTools/npm-publish@v1
127+
with:
128+
access: "public"
129+
token: ${{ env.NPM_TOKEN }}
130+
package: ${{ github.workspace }}/sdk/nodejs/bin/package.json
131+
- if: ${{ matrix.language == 'dotnet' && env.PUBLISH_NUGET == 'true' }}
132+
name: publish nuget package
133+
run: |
134+
dotnet nuget push ${{ github.workspace }}/sdk/dotnet/bin/Debug/*.nupkg -s ${{ env.NUGET_FEED_URL }} -k ${{ env.NUGET_PUBLISH_KEY }}
135+
echo "done publishing packages"
136+
strategy:
137+
fail-fast: true
138+
matrix:
139+
dotnetversion:
140+
- 6.0.408
141+
goversion:
142+
- "1.20"
143+
language:
144+
- nodejs
145+
- python
146+
- dotnet
147+
- go
148+
nodeversion:
149+
- 18.x
150+
pythonversion:
151+
- "3.9"

0 commit comments

Comments
 (0)