Skip to content

Commit a9af7e7

Browse files
Merge branch 'main' into cx/redact-api-keys-from-tty
2 parents 0e60d09 + 6c86813 commit a9af7e7

File tree

190 files changed

+2123
-1086
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+2123
-1086
lines changed

.github/actions/python-build-env-setup/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ inputs:
1010
runs:
1111
using: "composite"
1212
steps:
13+
- name: Fetch git tags
14+
shell: bash
15+
run: |
16+
git fetch --tags origin
17+
1318
- name: Set up Python
1419
uses: actions/setup-python@v4
1520
with:

.github/actions/version-dot-buildnum-generate/action.yml

Lines changed: 68 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@ description: |
1616
build artifact file that contains the same.
1717
1818
This action assumes it is working with a Semantic Versioning version
19-
number. The form of the final, full version number is
20-
<branch invariant version>.<build number>-<build variant>
21-
19+
number.
20+
2221
References:
2322
https://semver.org/
2423
https://packaging.python.org/en/latest/specifications/version-specifiers/
24+
https://peps.python.org/pep-0440/
2525
26-
# TODO: Detect branch for consideration of constructing a build_variant automatically?
27-
# Unless we have a strict branching/release policy, this may never be possible.
2826
# TODO: add support for epochs (e.g. "<epoch>!" prefix)
29-
# TODO: add support for local variants (e.g. "+<local variant>" suffix)
3027
# TODO: Can/should we *also* encode the SHA? While I dislike its lack of sequence
3128
# or uniqueness, it *does* encode useful information.
3229

@@ -58,35 +55,83 @@ runs:
5855
using: "composite"
5956
steps:
6057
- id: generate-version-with-buildnum
58+
# This was initially developed to be a generic semver build number
59+
# generator. PEP 440 has some quirks in regard to the semver specification:
60+
# - PEP 440 specifies variant suffixes of the form "b#" over "-beta[.#]"
61+
# In practice, this makes it harder to promote the build number as part of
62+
# the version that appears before the pre-release suffix.
63+
# - PEP 440 expects single letter variants "a", "b", "rc" over
64+
# the textual "alpha", "beta", "rc" identifiers, and only
65+
# expects these defined pre-release variants. Other variants
66+
# do not seem to be well-supported by python tooling.
67+
# - PEP 440 treats development releases as different from the variant,
68+
# rather than being a pre-release variant of pre-alpha maturity.
69+
# Fully handling this would be more complex.
6170
name: "Prepare build version file"
6271
shell: bash
6372
run: |
64-
# Should be closely synonymous with SCM branch
65-
version_invariant=$(head -1 version.txt | tr -d '\n')
66-
67-
# "pre-release" in semver
68-
if [ "${{ inputs.build-variant }}" = "release" ]
69-
then
70-
version_variant=""
71-
else
72-
version_variant=${{ inputs.build-variant }}
73-
fi
74-
7573
# Generated build number
7674
build_timestamp_b10=$(date +%s) # Time based build number - Base 10
7775
build_timestamp_b16=$(printf '%x' ${build_timestamp_b10}) # Time based build number - Base 16 - More compact, but might be interpreted as a non-digit
7876
build_timestamp_bx16=$(printf '0x%x' ${build_timestamp_b10}) # As above, with leading '0x' so it's never not seen as hex (but is less compact)
79-
# Python packaging doesn't like the "x" in the build number build numbers (even though it makes it less ambigious)
80-
# Reverting to base 10 for now. *sigh*
81-
version_buildnum=${build_timestamp_b10}
77+
semver_buildnum=${build_timestamp_b10}
78+
79+
# The invariant portion of the version should be closely
80+
# synonymous with SCM branch
81+
version_invariant=$(head -1 version.txt | tr -d '\n')
82+
83+
# Configure the pre-release variant for the semver
84+
semver_variant=${{ inputs.build-variant }}
85+
case "${{ inputs.build-variant }}" in
86+
dev)
87+
# PEP 440 treats "dev" as a different dimmension than the variant.
88+
# Squashing to alpha to reduce dimmensions we use.
89+
semver_variant_py="a"
90+
semver_buildnum_py="${semver_buildnum}"
91+
;;
92+
alpha)
93+
semver_variant_py="a"
94+
semver_buildnum_py="${semver_buildnum}"
95+
;;
96+
beta)
97+
semver_variant_py="b"
98+
semver_buildnum_py="${semver_buildnum}"
99+
;;
100+
rc)
101+
semver_variant_py="rc"
102+
semver_buildnum_py="${semver_buildnum}"
103+
;;
104+
release)
105+
semver_variant_py=""
106+
# PEP 440 specifies "+<build>" for local variants,
107+
# making it harder to use it for a public release build number.
108+
semver_buildnum_py=""
109+
;;
110+
*)
111+
echo "Unknown build variant: ${{ inputs.build-variant }}"
112+
exit 1
113+
;;
114+
esac
82115
83116
# Putting it all together
84-
printf "${version_invariant}.${version_buildnum}${version_variant:+-}${version_variant}" > version-with-buildnum.txt
117+
118+
# Semver variant 1:
119+
# <version>.<buildnum>-<variant>
120+
# printf "${version_invariant}.${semver_buildnum}${semver_variant:+-}${semver_variant}" > version-with-buildnum.txt
121+
122+
# Semver variant 2:
123+
# <version>-<variant>+<buildnum>
124+
# printf "${version_invariant}${semver_variant:+-}${semver_variant}${semver_buildnum:++}${semver_buildnum}" > version-with-buildnum.txt
125+
126+
# PEP 440 semver variant:
127+
printf "${version_invariant}${semver_variant_py}${semver_buildnum_py}" > version-with-buildnum.txt
128+
129+
# Saving the result as an artifact
85130
echo "Created version-with-buildnum.txt : $(cat version-with-buildnum.txt)"
86131
echo "version-with-buildnum=$(cat version-with-buildnum.txt)" | tee -a $GITHUB_OUTPUT
87132
echo "version=$(cat version.txt)" | tee -a $GITHUB_OUTPUT
88-
echo "buildnum=${version_buildnum}" | tee -a $GITHUB_OUTPUT
89-
echo "variant-normal=${version_variant}" | tee -a $GITHUB_OUTPUT
133+
echo "buildnum=${semver_buildnum}" | tee -a $GITHUB_OUTPUT
134+
echo "variant-normal=${semver_variant}" | tee -a $GITHUB_OUTPUT
90135
echo "variant-raw=${{ inputs.build-variant }}" | tee -a $GITHUB_OUTPUT
91136
- name: Save Artifacts - version-with-buildnum.txt
92137
uses: actions/upload-artifact@v4

.github/workflows/release-build.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ jobs:
2222
uses: ./.github/actions/python-build-env-setup
2323
with:
2424
python-version: ${{ env.PYTHON_VERSION }}
25-
- name: "Pull Build Number"
26-
uses: ./.github/actions/version-dot-buildnum-fetch
27-
with:
28-
version-file: version-with-buildnum.txt
2925
- name: 'Nox: Build Packages'
3026
run: |
3127
nox -s pkg_build_wheel
@@ -44,7 +40,9 @@ jobs:
4440
path: dist/planet_auth*.tar.gz
4541

4642
# Not building this as a release artifact at this time.
47-
# Docs are published to ReadTheDocs through other mechanisms.
43+
# Docs are published to ReadTheDocs through a webhook
44+
# which causes ReadTheDocs.io to pull, build, and publish
45+
# according to its own configuration.
4846
#
4947
# build-docs:
5048
# name: "Build Documentation Packages"
@@ -56,13 +54,12 @@ jobs:
5654
# uses: ./.github/actions/python-build-env-setup
5755
# with:
5856
# python-version: ${{ env.PYTHON_VERSION }}
59-
# # - name: "Pull Build Number"
60-
# # uses: ./.github/actions/version-dot-buildnum-fetch
61-
# # with:
62-
# # version-file: version-with-buildnum.txt
6357
# - name: "Nox: MKDocs Build"
6458
# run: |
6559
# nox -s mkdocs_build
60+
# - name: "Nox: MKDocs Check Links"
61+
# run: |
62+
# nox -s mkdocs_checklinks
6663
# - name: "Save Artifacts - MkDocs"
6764
# uses: actions/upload-artifact@v4
6865
# with:

.github/workflows/release-orchestrate.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ jobs:
6363
then
6464
git tag -a -m "Tagging from release orchestration pipeline" "${{steps.gen-buildnum.outputs.version}}"
6565
git push origin "${{steps.gen-buildnum.outputs.version}}"
66+
else
67+
git tag -a -m "Tagging from release orchestration pipeline" "${{steps.gen-buildnum.outputs.version-with-buildnum}}"
68+
git push origin "${{steps.gen-buildnum.outputs.version-with-buildnum}}"
6669
fi
67-
git tag -a -m "Tagging from release orchestration pipeline" "${{steps.gen-buildnum.outputs.version-with-buildnum}}"
68-
git push origin "${{steps.gen-buildnum.outputs.version-with-buildnum}}"
6970
test:
7071
name: "Prerelease Tests"
7172
uses: ./.github/workflows/test.yml
@@ -81,21 +82,21 @@ jobs:
8182
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8283
steps:
8384
- name: "Create Github Release (Version candidate release)"
84-
# if: needs.generate-build-number.outputs.version-variant-raw != 'release'
85+
if: needs.generate-build-number.outputs.version-variant-raw != 'release'
8586
uses: actions/create-release@v1
8687
with:
87-
tag_name: "${{ needs.generate-build-number.outputs.version-with-buildnum }}"
88+
tag_name: "release-${{ needs.generate-build-number.outputs.version-with-buildnum }}"
8889
release_name: "${{ needs.generate-build-number.outputs.version-with-buildnum }}"
8990
draft: false
90-
prerelease: ${{ inputs.version-prerelease }}
91+
prerelease: true
9192
- name: "Create Github Release (Final version release)"
9293
if: needs.generate-build-number.outputs.version-variant-raw == 'release'
9394
uses: actions/create-release@v1
9495
with:
95-
tag_name: "${{ needs.generate-build-number.outputs.version }}"
96+
tag_name: "release-${{ needs.generate-build-number.outputs.version }}"
9697
release_name: "${{ needs.generate-build-number.outputs.version }}"
9798
draft: false
98-
prerelease: ${{ inputs.version-prerelease }}
99+
prerelease: false
99100
package:
100101
name: "Build Release Artifacts"
101102
uses: ./.github/workflows/release-build.yml

.github/workflows/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,8 @@ jobs:
173173
- name: 'Nox: MKDocs Build'
174174
run: |
175175
nox -s mkdocs_build
176+
# Not checking the links in the pipeline right now.
177+
# This is throwing some false positives on intra-md links
178+
# that build OK, and would also be caught by our mkdocs
179+
# strict mode setting.
180+
# nox -s mkdocs_checklinks

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Planet Auth Utility Library
2+
[![Build Status](https://github.com/planetlabs/planet-auth-python/actions/workflows/test.yml/badge.svg)](https://github.com/planetlabs/planet-auth-python/actions/workflows/test.yml)
3+
[![Read The Docs](https://app.readthedocs.org/projects/planet-auth/badge/)](https://planet-auth.readthedocs.io/)
4+
[![PyPI Downloads (pypistats.org)](https://img.shields.io/pypi/dm/planet-auth)](https://pypistats.org/packages/planet-auth)
5+
[![PyPI Downloads (peppy.tech)](https://static.pepy.tech/badge/planet-auth)](https://pepy.tech/projects/planet-auth)
26

37
The Planet Auth Library provides generic authentication utilities for clients
48
and for services. For clients, it provides means to obtain access tokens that

RELEASE.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ To release a new version, complete the following steps:
2525

2626
1. Create a release branch off of `main` that bumps the version number in
2727
branch invariant [version.txt](./version.txt) file, and updates the
28-
[changelog.md](./docs/changelog.md). The [version-with-buildnum.txt](./version-with-buildnum.txt)
29-
should also be kept up to date, and is used to assign versions to local
30-
builds.
28+
[changelog.md](./docs/changelog.md).
3129
2. Collect all features targeted for the intended release in the branch, and
3230
create a PR to merge the release branch into `main`.
3331
3. Ensure that all tests are passing on `main` branch after all merges.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ::: planet_auth_config_injection
2+
options:
3+
show_root_full_path: true
4+
inherited_members: true
5+
show_submodules: true
6+
show_if_no_docstring: false

docs/api-planet-auth-utils.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ::: planet_auth_utils
2+
options:
3+
show_root_full_path: true
4+
inherited_members: true
5+
show_submodules: true
6+
show_if_no_docstring: false

docs/api-planet-auth.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ::: planet_auth
2+
options:
3+
show_root_full_path: true
4+
inherited_members: true
5+
show_submodules: true
6+
show_if_no_docstring: false

0 commit comments

Comments
 (0)