Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed version into the SDKs #161

Merged
merged 17 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v4

- uses: pulumi/provider-version-action@v1
id: provider-version
with:
set-env: "PROVIDER_VERSION"

- name: Install Go
uses: actions/setup-go@v4
with:
Expand Down Expand Up @@ -76,26 +81,20 @@ jobs:
with:
repo: pulumi/pulumictl

- name: Set PACKAGE_VERSION to Env
env:
PACKAGE_VERSION: ${{ inputs.version }}
run: echo "PACKAGE_VERSION=$PACKAGE_VERSION" >>
$GITHUB_ENV

- name: Build & Install Provider & SDKs
run: |
make build
make install

- name: Check worktree clean
run: |
git update-index -q --refresh
if ! git diff-files --quiet; then
>&2 echo "error: working tree is not clean, aborting!"
git status
git diff
exit 1
fi
uses: pulumi/git-status-check-action@v1
with:
allowed-changes: |
sdk/**/pulumi-plugin.json
sdk/dotnet/Pulumi.*.csproj
sdk/go/**/pulumiUtilities.go
sdk/nodejs/package.json
sdk/python/pyproject.toml

- name: Install gotestfmt
uses: GoTestTools/gotestfmt-action@v2
Expand All @@ -104,7 +103,7 @@ jobs:
version: v2.4.0

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ${{ env.AWS_REGION }}
Expand Down
121 changes: 109 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
name: Release provider & SDKs
on:
workflow_call:
inputs:
version:
description: "Version to be released"
type: string
required: true
publishProvider:
description: "Publish provider binaries (to GH & S3)"
default: true
type: boolean
publishNpm:
description: "Publish Node.js SDK"
default: true
type: boolean
publishNuget:
description: "Publish .NET SDK"
default: true
type: boolean
publishPython:
description: "Publish Python SDK"
default: true
type: boolean
publishJava:
description: "Publish Java SDK"
default: true
type: boolean
publishGo:
description: "Publish Go SDK"
default: true
type: boolean
workflow_dispatch:
inputs:
version:
Expand Down Expand Up @@ -60,7 +90,7 @@ env:
SIGNING_PASSWORD: ${{ secrets.JAVA_SIGNING_PASSWORD }}
PUBLISH_REPO_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
PUBLISH_REPO_USERNAME: ${{ secrets.OSSRH_USERNAME }}
PACKAGE_VERSION: ${{ inputs.version }}
PROVIDER_VERSION: ${{ inputs.version }}
DOTNET_VERSION: "6.x"
GO_VERSION: "1.21.x"
JAVA_VERSION: "11"
Expand Down Expand Up @@ -178,14 +208,14 @@ jobs:
run: make build_${{ matrix.language }}_sdk VERSION=${{ inputs.version }}

- name: Check worktree clean
run: |
git update-index -q --refresh
if ! git diff-files --quiet; then
>&2 echo "error: working tree is not clean, aborting!"
git status
git diff
exit 1
fi
uses: pulumi/git-status-check-action@v1
with:
allowed-changes: |
sdk/**/pulumi-plugin.json
sdk/dotnet/Pulumi.*.csproj
sdk/go/**/pulumiUtilities.go
sdk/nodejs/package.json
sdk/python/pyproject.toml

- name: Publish Python SDK
if: ${{ inputs.publishPython && matrix.language == 'python' }}
Expand All @@ -194,6 +224,7 @@ jobs:
user: ${{ env.PYPI_USERNAME }}
password: ${{ env.PYPI_PASSWORD }}
packages-dir: ${{github.workspace}}/sdk/python/bin/dist
skip-existing: true

- name: Publish Node SDK
if: ${{ inputs.publishNpm && matrix.language == 'nodejs' }}
Expand All @@ -210,13 +241,79 @@ jobs:
echo "done publishing packages"

- name: Publish Java SDK
if: ${{ inputs.publishJava && matrix.language == 'java' }}
# Disable Java SDK publishing for pre-release versions
if: ${{ inputs.publishJava && matrix.language == 'java' && !contains(inputs.version, '-') }}
uses: gradle/gradle-build-action@v3
with:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
build-root-directory: ./sdk/java
gradle-version: 8.3

- name: Publish Go SDK
- uses: pulumi/publish-go-sdk-action@v1
if: ${{ inputs.publishGo && matrix.language == 'go' }}
run: git tag sdk/v${{ inputs.version }} && git push origin sdk/v${{ inputs.version }}
with:
repository: ${{ github.repository }}
base-ref: ${{ github.sha }}
source: sdk
path: sdk
version: ${{ inputs.version }}
additive: false
# Avoid including other language SDKs & artifacts in the commit
files: |
go.*
go/**
!*.tar.gz

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: us-west-2
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-duration-seconds: 3600
role-session-name: aws-apigateway@githubActions
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}

- name: Verify nodejs release
if: ${{ inputs.publishNpm && matrix.language == 'nodejs' }}
uses: pulumi/verify-provider-release@v1
with:
runtime: nodejs
directory: examples/simple
provider: aws-apigateway
providerVersion: ${{ inputs.version }}

- name: Get python version
id: python-package-version
if: ${{ inputs.publishPython && matrix.language == 'python' }}
run: |
{
echo -n "version="
cat sdk/python/pyproject.toml | sed -nE 's/.*version.*=.*"(.+)"/\1/p'
} >> "${GITHUB_OUTPUT}"

- name: Wait for python package to be available
if: ${{ inputs.publishPython && matrix.language == 'python' }}
timeout-minutes: 15
continue-on-error: true
run: |
while ! (pip index versions --pre pulumi-aws-apigateway | grep -q " ${{ steps.python-package-version.outputs.version }}"); do sleep 5; done

- name: Verify python release
if: ${{ inputs.publishPython && matrix.language == 'python' }}
uses: pulumi/verify-provider-release@v1
with:
runtime: python
directory: examples/simple-py
provider: aws-apigateway
providerVersion: ${{ inputs.version }}
packageVersion: ${{ steps.python-package-version.outputs.version }}

- name: Verify go release
if: ${{ inputs.publishGo && matrix.language == 'go' }}
uses: pulumi/verify-provider-release@v1
with:
runtime: go
directory: examples/simple-go
provider: aws-apigateway
providerVersion: ${{ inputs.version }}
21 changes: 13 additions & 8 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@ on:
tags:
- v*.*.*
jobs:
dispatch_publish:
name: Dispatch Release Workflow
version:
name: Calculate version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.format_version.outputs.version }}
steps:
- id: format_version
# Replace the leading v
# Outputs must be in the form `var=` so we can access the value
run: echo "${{ github.ref_name }}" | sed "s/^v/version=/" >> $GITHUB_OUTPUT
- name: Dispatch Release Workflow
uses: benc-uk/[email protected]
with:
workflow: release.yml
inputs: '{ "version": "${{ steps.format_version.outputs.version }}" }'
run: echo "${{ github.ref_name }}" | sed "s/^v/version=/" >> "${GITHUB_OUTPUT}"

release:
name: Release
uses: ./.github/workflows/release.yml
needs: version
secrets: inherit
with:
version: ${{ needs.version.outputs.version }}
1 change: 1 addition & 0 deletions .pulumi.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.126.0
Loading
Loading