This action calculates the version to be used during a Pulumi provider build.
The calculated version is always valid semver 2.0.0 – with no leading "v".
- uses: pulumi/provider-version-action@v1
with:
# Optional name of the environment variable to set with the calculated version, for example: PROVIDER_VERSION
# Defaults to empty which results in no environment variable being set.
set-env: ''
Name | Description | Example |
---|---|---|
version |
The calculated version for the current build | 1.3.0-alpha.1577836800+699a10d |
Set the PROVIDER_VERSION
environment variable for use in any subsequent steps within the current job:
steps:
- uses: pulumi/provider-version-action@v1
with:
set-env: PROVIDER_VERSION
- name: Print version
run: echo "${PROVIDER_VERSION}"
Access the calculated version via the step's output:
steps:
- id: version
uses: pulumi/provider-version-action@v1
- name: Print version
run: echo "${{ steps.version.outputs.version }}"
Calculate the version once in a standalone job for all other jobs to reference:
jobs:
version:
runs-on: ubuntu-latest
steps:
- id: version
uses: pulumi/provider-version-action@v1
outputs:
version: ${{ steps.version.outputs.version }}
build:
runs-on: ubuntu-latest
needs: version
steps:
- name: Print version
run: echo "${{ needs.version.outputs.version }}"
This action supports 3 build scenarios:
- Pushing a version tag beginning with "v" (e.g.
v1.2.3
). The version from the tag will be used e.g.1.2.3
- Pushing to a main branch. An alpha version will be generated e.g.
1.2.3-alpha.1577836800
- Building a pull request. An alpha version will be generated, with a shorthash suffix e.g.
1.2.3-alpha.1577836800+699a10d
When we're wanting to build for a different major version from the last release, we can do this using two methods:
- Use a version branch containing just the major version number e.g. (
v1
orv7
). Pushing to this branch, or opening a pull request with this branch as the "base" will use this major version. - Add the label
needs-release/major
to a pull request. This will cause the version number to be incremented by a major increment instead of a minor increment. The major increment will be used when building the PR and when building the commit after being merged.
Note: if the needs-release/major
label is used on a version branch, the label will be ignored and the version branch used.
When building a branch or a pull-request, an alpha version will be generated with the following features:
2.43.0-alpha.1577836800+699a10d
| | | | | |
| | | | | ShortHash
| | | | Timestamp
| | | Label
| | Patch
| Minor
Major
- The major, minor and patch numbers are taken from the latest release and incremented to the next minor version.
- The alpha label.
- Commit timestamp to order pre-releases sequentially.
- Short hash of the commit to help identify the source where the release originated.