Skip to content

Commit

Permalink
BREAKING CHANGE: Use explicit version for release (#24)
Browse files Browse the repository at this point in the history
This was missed as part of pulumi/ci-mgmt#900

We no longer use pulumictl to re-calculate the version multiple times
throughout a workflow. Instead, we use the
`pulumi/provider-version-action` to calculate the version, and prefer
passing the version around as an explicit variable to ensure it never
gets changed.

The new version is slightly different to the one generated by pulumictl
- using a shorthash of 7 characters rather than 8.

1. Add a new required input for `version` (BREAKING CHANGE).
2. Set the version input to the `PROVIDER_VERSION` which is the env name
we use in all other jobs for the version of the _provider_ - for the SDK
release sub-jobs which need it.
3. During the Java SDK publish sub-job, set the java-specific
`PACKAGE_VERSION` env variable.

## Breaking Change Rational

We always reference the exact version of this action and we've made
previous breaking changes, so it's better to avoid the complexity for
backward compatibility as we'll need to update all call sites with the
new version anyway.
  • Loading branch information
danielrbradley authored Apr 30, 2024
1 parent 4cbb25e commit b3f007b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 5 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: 'Pulumi Package publisher'
description: 'A GitHub Action that publishes provider SDKs'
inputs:
version:
description: The version of the provider being published.
required: true
sdk:
description: |
The name of the language SDK being published.
Expand Down Expand Up @@ -42,9 +45,6 @@ runs:
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
shell: bash
- name: Install Go
uses: actions/setup-go@v3
with:
Expand All @@ -56,7 +56,6 @@ runs:
- name: Install Pulumi CLI
uses: pulumi/action-install-pulumi-cli@v2


# `uses:` statements do not support expressions
# (https://github.com/actions/runner/issues/895), so this is invalid:
#
Expand Down Expand Up @@ -86,3 +85,5 @@ runs:
- name: Java - Publish to Maven
if: (contains(inputs.sdk, 'java') || (contains(inputs.sdk, 'all') && !contains(inputs.sdk, '!all'))) && !contains(inputs.sdk, '!java')
uses: ./.pulumi-package-publish/lang/java
env:
PROVIDER_VERSION: ${{ inputs.version }}
6 changes: 2 additions & 4 deletions lang/java/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ runs:
run: tar -zxf ${{github.workspace}}/sdk/java.tar.gz -C
${{github.workspace}}/sdk/java
shell: bash
- name: Set PACKAGE_VERSION to Env
run: echo "PACKAGE_VERSION=$(pulumictl get version --language generic)" >>
$GITHUB_ENV
shell: bash
- name: Publish Java SDK
continue-on-error: true
uses: gradle/gradle-build-action@9b814496b50909128c6a52622b416c5ffa04db49
env:
PACKAGE_VERSION: ${{ env.PROVIDER_VERSION }}
with:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
build-root-directory: ./sdk/java
Expand Down

0 comments on commit b3f007b

Please sign in to comment.