Skip to content

Commit

Permalink
Upgrade publishing workflows (#1390)
Browse files Browse the repository at this point in the history
Upgrade publishing workflows to more modern versions borrowing from
pulumi/pulumi-aws. Fixes Node SDK publishing. Since Node SDK is now
generated under sdk/node and is no longer special compared to other SDKs
some changes were needed to the GitHub Actions publishing process to get
it to work right.
  • Loading branch information
t0yv0 authored Sep 26, 2024
1 parent ead5fdc commit fa3ddf5
Show file tree
Hide file tree
Showing 12 changed files with 346 additions and 590 deletions.
19 changes: 19 additions & 0 deletions .github/actions/download-sdk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Download SDK asset
description: Restores the SDK asset for a language.

inputs:
language:
required: true
description: One of nodejs, python, dotnet, go, java

runs:
using: "composite"
steps:
- name: Download ${{ inputs.language }} SDK
uses: actions/download-artifact@v4
with:
name: ${{ inputs.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: Uncompress SDK folder
shell: bash
run: tar -zxf ${{ github.workspace }}/sdk/${{ inputs.language }}.tar.gz -C ${{ github.workspace }}/sdk/${{ inputs.language }}
84 changes: 84 additions & 0 deletions .github/actions/setup-tools/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Setup tools
description: Installs Go, Pulumi, pulumictl, schema-tools, Node.JS, Python, dotnet and Java.

inputs:
tools:
description: |
Comma separated list of tools to install. The default of "all" installs all tools. Available tools are:
go
pulumicli
pulumictl
schema-tools
nodejs
python
dotnet
java
default: all

runs:
using: "composite"
steps:
- name: Install Go
if: inputs.tools == 'all' || contains(inputs.tools, 'go')
uses: actions/setup-go@v5
with:
# TODO: here pulumi-eks diverges from the 1.21.x standard, to upgrade separately.
# go-version: "1.21.x"
go-version: "1.18.x"
cache-dependency-path: |
provider/*.sum
upstream/*.sum
sdk/*.sum
- name: Install pulumictl
if: inputs.tools == 'all' || contains(inputs.tools, 'pulumictl')
uses: jaxxstorm/[email protected]
with:
tag: v0.0.46
repo: pulumi/pulumictl

- name: Install Pulumi CLI
if: inputs.tools == 'all' || contains(inputs.tools, 'pulumicli')
uses: pulumi/actions@v5
with:
pulumi-version: "dev"

- name: Install Schema Tools
if: inputs.tools == 'all' || contains(inputs.tools, 'schema-tools')
uses: jaxxstorm/[email protected]
with:
repo: pulumi/schema-tools

- name: Setup Node
if: inputs.tools == 'all' || contains(inputs.tools, 'nodejs')
uses: actions/setup-node@v4
with:
# TODO: here pulumi-eks diverges from 20.x standard; will need to update.
node-version: 18.x
registry-url: https://registry.npmjs.org

- name: Setup DotNet
if: inputs.tools == 'all' || contains(inputs.tools, 'dotnet')
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x

- name: Setup Python
if: inputs.tools == 'all' || contains(inputs.tools, 'python')
uses: actions/setup-python@v5
with:
python-version: 3.11.8

- name: Setup Java
if: inputs.tools == 'all' || contains(inputs.tools, 'java')
uses: actions/setup-java@v4
with:
cache: gradle
distribution: temurin
java-version: 11

- name: Setup Gradle
if: inputs.tools == 'all' || contains(inputs.tools, 'java')
uses: gradle/gradle-build-action@v3
with:
gradle-version: 7.6
15 changes: 2 additions & 13 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,20 +168,9 @@ jobs:
sdk/go/**/pulumiUtilities.go
sdk/nodejs/package.json
sdk/python/pyproject.toml
- name: Compress NodeJS SDK folder
if: matrix.language == 'nodejs'
run: tar -zcf ${{ matrix.language }}.tar.gz -C ${{ matrix.language }}/ .
- name: Upload NodeJS artifacts
if: matrix.language == 'nodejs'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.language }}-sdk.tar.gz
path: ${{ github.workspace}}/${{ matrix.language }}.tar.gz
- name: Compress Other Lang SDK folder
if: matrix.language != 'nodejs'
- name: Compress ${{ matrix.language }} SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }}/ .
- name: Upload Other Lang artifacts
if: matrix.language != 'nodejs'
- name: Upload ${{ matrix.language }} artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.language }}-sdk.tar.gz
Expand Down
162 changes: 10 additions & 152 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,20 +168,9 @@ jobs:
sdk/go/**/pulumiUtilities.go
sdk/nodejs/package.json
sdk/python/pyproject.toml
- name: Compress NodeJS SDK folder
if: matrix.language == 'nodejs'
run: tar -zcf ${{ matrix.language }}.tar.gz -C ${{ matrix.language }}/ .
- name: Upload NodeJS artifacts
if: matrix.language == 'nodejs'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.language }}-sdk.tar.gz
path: ${{ github.workspace}}/${{ matrix.language }}.tar.gz
- name: Compress Other Lang SDK folder
if: matrix.language != 'nodejs'
- name: Compress ${{ matrix.language }} SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }}/ .
- name: Upload Other Lang artifacts
if: matrix.language != 'nodejs'
- name: Upload ${{ matrix.language }} artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.language }}-sdk.tar.gz
Expand All @@ -195,6 +184,7 @@ jobs:
- dotnet
- java
- go

publish:
name: publish
needs:
Expand All @@ -203,145 +193,13 @@ jobs:
- test-python
- test-dotnet
- test-go
runs-on: ubuntu-latest
env:
PROVIDER_VERSION: ${{ needs.prerequisites.outputs.version }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: us-east-2
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-duration-seconds: 7200
role-external-id: upload-pulumi-release
role-session-name: ${{ env.PROVIDER}}@githubActions
role-to-assume: ${{ secrets.AWS_UPLOAD_ROLE_ARN }}
- uses: MOZGIII/install-ldid-action@v1
with:
tag: v2.1.5-procursus2
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/actions@v5
- name: Create Provider Binaries
run: make dist
- name: Upload Provider Binaries
run: aws s3 cp dist s3://get.pulumi.com/releases/plugins/ --recursive
publish_sdk:
name: publish_sdk
needs:
- prerequisites
- publish
runs-on: ubuntu-latest
env:
PROVIDER_VERSION: ${{ needs.prerequisites.outputs.version }}
PACKAGE_VERSION: ${{ needs.prerequisites.outputs.version }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVERSION }}
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/actions@v5
- name: Setup Node
uses: actions/setup-node@v4
with:
always-auth: true
node-version-file: .node-version
registry-url: https://registry.npmjs.org
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHONVERSION }}
- name: Download NodeJS SDK
uses: actions/download-artifact@v4
with:
name: nodejs-sdk.tar.gz
path: ${{ github.workspace}}
- name: Uncompress NodeJS SDK folder
run: tar -zxf ${{ github.workspace}}/nodejs.tar.gz -C ${{github.workspace}}/nodejs
- name: Download Python SDK
uses: actions/download-artifact@v4
with:
name: python-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: Uncompress Python SDK folder
run: tar -zxf ${{ github.workspace}}/sdk/python.tar.gz -C ${{github.workspace}}/sdk/python
- name: Install Twine
run: python -m pip install pip twine
- name: Download DotNet SDK
uses: actions/download-artifact@v4
with:
name: dotnet-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: Uncompress DotNet SDK folder
run: tar -zxf ${{ github.workspace}}/sdk/dotnet.tar.gz -C ${{github.workspace}}/sdk/dotnet
- env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
name: Publish SDK
run: ./scripts/publish_packages.sh
publish_java_sdk:
name: publish_java_sdk
needs:
- prerequisites
- publish
runs-on: ubuntu-latest
env:
PROVIDER_VERSION: ${{ needs.prerequisites.outputs.version }}
PACKAGE_VERSION: ${{ needs.prerequisites.outputs.version }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVERSION }}
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/actions@v5
- name: Setup Node
uses: actions/setup-node@v4
with:
always-auth: true
node-version-file: .node-version
registry-url: https://registry.npmjs.org
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHONVERSION }}
- name: Setup Java
uses: actions/setup-java@v4
with:
cache: gradle
distribution: temurin
java-version: ${{ env.JAVAVERSION }}
- name: Download Java SDK
uses: actions/download-artifact@v4
with:
name: java-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: Uncompress Java SDK folder
run: tar -zxf ${{ github.workspace}}/sdk/java.tar.gz -C ${{github.workspace}}/sdk/java
- name: Publish Java SDK
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1
with:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
build-root-directory: ./sdk/java
gradle-version: 7.4.1
uses: ./.github/workflows/publish.yml
secrets: inherit
with:
version: ${{ needs.prerequisites.outputs.version }}
isPrerelease: true
skipGoSdk: true

test-nodejs:
name: Run NodeJS Tests
needs:
Expand Down
Loading

0 comments on commit fa3ddf5

Please sign in to comment.