Skip to content

Commit

Permalink
chore: make release action faster and allow publish to pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignacio Anaya committed Jun 15, 2022
1 parent e40492a commit 3109ca2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 23 deletions.
66 changes: 44 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Release 🚀
name: release 🚀
on:
push:
tags:
- 'v*'
- 'v*.*.*'

env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Expand All @@ -12,9 +12,11 @@ env:
PUBLISH_NUGET: true
NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }}
NUGET_FEED_URL: https://api.nuget.org/v3/index.json
PUBLISH_PYPI: true
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

jobs:
publish-binary:
publish_binary:
name: Publish Binary
runs-on: ubuntu-latest

Expand All @@ -25,35 +27,33 @@ jobs:
- name: Unshallow to restore tags
run: git fetch --prune --unshallow

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.16.x

- name: Set up .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: '3.1.x'

- name: Set up NodeJS
uses: actions/setup-node@v3
- name: Install Go
uses: actions/setup-go@v2
with:
registry-url: 'https://registry.npmjs.org'
always-auth: true
go-version: ${{matrix.goversion}}

- name: Install pulumictl
run: curl -L https://github.com/pulumi/pulumictl/releases/download/v0.0.25/pulumictl-v0.0.25-linux-amd64.tar.gz | sudo tar zxv -C /usr/bin -f- pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist

publish-sdk:
strategy:
fail-fast: true
matrix:
goversion:
- 1.17.x

publish:
name: Publish SDKs
runs-on: ubuntu-latest
needs: publish-binary
needs: publish_binary

steps:
- name: Checkout Repo
uses: actions/checkout@v3
Expand All @@ -69,11 +69,21 @@ jobs:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/[email protected]

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.nodeversion }}
registry-url: ${{ env.NPM_REGISTRY_URL }}
- name: Setup DotNet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnetverson }}
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.pythonversion }}

- name: Build SDK
run: make build_${{ matrix.language }}_sdk
- name: Check worktree clean
Expand All @@ -85,17 +95,28 @@ jobs:
git diff
exit 1
fi
- if: ${{ matrix.language == 'nodejs' && env.PUBLISH_NPM == 'true' }}
uses: JS-DevTools/npm-publish@v1
with:
access: "public"
token: ${{ env.NPM_TOKEN }}
package: ${{ github.workspace }}/sdk/nodejs/bin/package.json

- if: ${{ matrix.language == 'dotnet' && env.PUBLISH_NUGET == 'true' }}
name: publish nuget package
run: |
dotnet nuget push ${{github.workspace}}/sdk/dotnet/bin/Debug/*.nupkg -s ${{ env.NUGET_FEED_URL }} -k ${{ env.NUGET_PUBLISH_KEY }}
echo "done publishing packages"
- if: ${{ matrix.language == 'python' && env.PUBLISH_PYPI == 'true' }}
name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ env.PYPI_TOKEN }}
packages_dir: ${{github.workspace}}/sdk/python/bin/dist

strategy:
fail-fast: true
matrix:
Expand All @@ -105,9 +126,10 @@ jobs:
- 1.17.x
language:
- nodejs
- go
- python
- dotnet
- go
nodeversion:
- 14.x
pythonversion:
- "3.9"
- "3.9"
1 change: 1 addition & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ changelog:
skip: true
release:
disable: false
prerelease: auto
extra_files:
- glob: sdk/python/bin/dist/pulumi_checkly-*.tar.gz
- glob: nuget/*.nupkg
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.4
0.0.5

0 comments on commit 3109ca2

Please sign in to comment.