Skip to content

Merge pull request #63 from pierskarsenbarg/fixing-go-version #55

Merge pull request #63 from pierskarsenbarg/fixing-go-version

Merge pull request #63 from pierskarsenbarg/fixing-go-version #55

Workflow file for this run

name: release
"on":
push:
tags:
- v*.*.*
- "!v*.*.*-**"
env:
PROVIDER: kubeconfig
GO_VERSION: "1.22.x"
NODEJS_VERSION: 20.x
DOTNET_VERSION: 6.0.302
PYTHON_VERSION: "3.12"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build_provider:
name: Build Provider
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{env.GO_VERSION}}
cache-dependency-path: "**/*.sum"
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.12.0
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/actions@v5
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build provider binary
run: task build_provider
- name: Check for presence of binary
run: ls ${{ github.workspace}}/bin/
- name: Tar provider binaries
run: tar -zcf ${{ github.workspace }}/bin/provider.tar.gz -C ${{ github.workspace }}/bin/ pulumi-resource-${{ env.PROVIDER }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROVIDER }}-provider.tar.gz
path: ${{ github.workspace }}/bin/provider.tar.gz
strategy:
fail-fast: true
matrix:
goversion:
- 1.22.x
build_sdks:
name: Build SDKs
runs-on: ubuntu-latest
needs: build_provider
strategy:
fail-fast: true
matrix:
language:
- nodejs
- python
- dotnet
- go
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Set Provider Version
uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION
- if: matrix.language == 'go'
name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{env.GO_VERSION}}
cache-dependency-path: "**/*.sum"
- if: matrix.language == 'nodejs'
name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{env.NODEJS_VERSION}}
- if: matrix.language == 'dotnet'
name: Setup DotNet
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{env.DOTNET_VERSION}}
- if: matrix.language == 'python'
name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Install Pulumi CLI
uses: pulumi/actions@v5
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.12.0
with:
repo: pulumi/pulumictl
- name: Download provider binaries
uses: actions/download-artifact@v4
with:
name: ${{ env.PROVIDER }}-provider.tar.gz
path: ${{ github.workspace }}/bin
- name: Untar provider binaries
run: |-
tar -zxf ${{ github.workspace }}/bin/provider.tar.gz -C ${{ github.workspace}}/bin
find ${{ github.workspace }} -name "pulumi-*-${{ env.PROVIDER }}" -print -exec chmod +x {} \;
- name: Update path
run: echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Build SDKs
run: task generate_${{matrix.language}}_sdk
- name: Check worktree clean
uses: pulumi/git-status-check-action@v1
with:
allowed-changes: |-
sdk/**/pulumi-plugin.json
sdk/dotnet/PiersKarsenbarg.*.csproj
sdk/go/**/pulumiUtilities.go
sdk/nodejs/package.json
sdk/python/pyproject.toml
- name: Compress SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.language }}.tar.gz
path: ${{ github.workspace}}/sdk/${{ matrix.language }}.tar.gz
publish_provider:
runs-on: ubuntu-latest
needs: build_sdks
name: publish_provider
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{env.GO_VERSION}}
cache-dependency-path: "**/*.sum"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
args: release --clean --timeout 60m0s
version: "~> v2"
strategy:
fail-fast: true
publish_sdks:
runs-on: ubuntu-latest
needs: publish_provider
permissions:
id-token: write
strategy:
fail-fast: true
matrix:
language:
- nodejs
- python
- dotnet
steps:
- if: matrix.language == 'nodejs'
name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{env.NODEJS_VERSION}}
registry-url: https://registry.npmjs.org
- if: matrix.language == 'dotnet'
name: Setup DotNet
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{env.DOTNET_VERSION}}
- if: matrix.language == 'python'
name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Download ${{matrix.language}} SDK
uses: actions/download-artifact@v4
with:
name: ${{matrix.language}}.tar.gz
path: ${{ github.workspace}}/sdk/
- name: Create ${{matrix.language}} directory
run: mkdir -p ${{github.workspace}}/sdk/${{matrix.language}}
- name: Uncompress ${{matrix.language}} SDK
run: tar -zxf ${{github.workspace}}/sdk/${{matrix.language}}.tar.gz -C ${{github.workspace}}/sdk/${{matrix.language}}
- if: matrix.language == 'python'
name: Publish PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ${{github.workspace}}/sdk/python/bin/dist
- if: matrix.language == 'nodejs'
name: Publish NPM package
uses: JS-DevTools/npm-publish@v3
with:
access: "public"
token: ${{ secrets.NPM_TOKEN }}
package: ${{github.workspace}}/sdk/nodejs/bin/package.json
- if: matrix.language == 'dotnet'
name: Publish Nuget package
env:
NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }}
run: find "${{github.workspace}}/sdk/dotnet/bin/Release/" -name 'PiersKarsenbarg.*.nupkg' -exec dotnet nuget push -k "${NUGET_PUBLISH_KEY}" -s https://api.nuget.org/v3/index.json {} ';'