Skip to content

Commit fadb32a

Browse files
Merge branch 'main' into carl/jwt-validator-commands
2 parents 22881b6 + 1c879bd commit fadb32a

38 files changed

+627
-99
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: 3 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,10 +54,6 @@ 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

.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

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
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+
[![PyPI Downloads](https://static.pepy.tech/badge/planet-auth)](https://pepy.tech/projects/planet-auth)
4+
[![Read The Docs](https://app.readthedocs.org/projects/planet-auth/badge/)](https://planet-auth.readthedocs.io/)
25

36
The Planet Auth Library provides generic authentication utilities for clients
47
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.

docs/changelog.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Changelog
22

3-
## 2.0.4.X - 2025
4-
- Initial Beta release series to shakedown public release pipelines and
5-
initial integrations.
3+
## 2.1.0 - 2025 TBD
4+
- Initial public release targeting integration with the
5+
[Planet Client for Python](https://github.com/planetlabs/planet-client-python).
66

7-
## [Unreleased: 2.0.0 - 2.0.3] - YYYY-MM-DD
8-
- 2.X is the initial public release of Planet auth libraries, targeting
9-
integration with our public Python SDK [`planet-client-python`](https://github.com/planetlabs/planet-client-python)
7+
## [Unreleased: 2.0.*] - YYYY-MM-DD
8+
- All releases in the 2.0.X series are development releases, even if not
9+
tagged as such. This work included some shakedowns of the release pipelines.
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<!--
2+
Planet Theme customization.
3+
4+
Source: https://github.com/squidfunk/mkdocs-material/blob/9.6.12/src/templates/partials/header.html
5+
6+
Customizations:
7+
- Add version to title so docs can be self-contained, and do not depend on
8+
external framing to understand what version they refer to.
9+
-->
10+
<!--
11+
Copyright (c) 2016-2025 Martin Donath <[email protected]>
12+
13+
Permission is hereby granted, free of charge, to any person obtaining a copy
14+
of this software and associated documentation files (the "Software"), to
15+
deal in the Software without restriction, including without limitation the
16+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
17+
sell copies of the Software, and to permit persons to whom the Software is
18+
furnished to do so, subject to the following conditions:
19+
20+
The above copyright notice and this permission notice shall be included in
21+
all copies or substantial portions of the Software.
22+
23+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
26+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
29+
IN THE SOFTWARE.
30+
-->
31+
32+
<!-- Determine classes -->
33+
{% set class = "md-header" %}
34+
{% if "navigation.tabs.sticky" in features %}
35+
{% set class = class ~ " md-header--shadow md-header--lifted" %}
36+
{% elif "navigation.tabs" not in features %}
37+
{% set class = class ~ " md-header--shadow" %}
38+
{% endif %}
39+
40+
<!-- Header -->
41+
<header class="{{ class }}" data-md-component="header">
42+
<nav
43+
class="md-header__inner md-grid"
44+
aria-label="{{ lang.t('header') }}"
45+
>
46+
47+
<!-- Link to home -->
48+
<a
49+
href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}"
50+
title="{{ config.site_name | e }} ({{ config.extra.site_version }})"
51+
class="md-header__button md-logo"
52+
aria-label="{{ config.site_name }} ({{ config.extra.site_version }})"
53+
data-md-component="logo"
54+
>
55+
{% include "partials/logo.html" %}
56+
</a>
57+
58+
<!-- Button to open drawer -->
59+
<label class="md-header__button md-icon" for="__drawer">
60+
{% set icon = config.theme.icon.menu or "material/menu" %}
61+
{% include ".icons/" ~ icon ~ ".svg" %}
62+
</label>
63+
64+
<!-- Header title -->
65+
<div class="md-header__title" data-md-component="header-title">
66+
<div class="md-header__ellipsis">
67+
<div class="md-header__topic">
68+
<span class="md-ellipsis">
69+
{{ config.site_name }} <span style="font-size: smaller">({{ config.extra.site_version }})</span>
70+
</span>
71+
</div>
72+
<div class="md-header__topic" data-md-component="header-topic">
73+
<span class="md-ellipsis">
74+
{% if page.meta and page.meta.title %}
75+
{{ page.meta.title }}
76+
{% else %}
77+
{{ page.title }}
78+
{% endif %}
79+
</span>
80+
</div>
81+
</div>
82+
</div>
83+
84+
<!-- Color palette toggle -->
85+
{% if config.theme.palette %}
86+
{% if not config.theme.palette is mapping %}
87+
{% include "partials/palette.html" %}
88+
{% endif %}
89+
{% endif %}
90+
91+
<!-- User preference: color palette -->
92+
{% if not config.theme.palette is mapping %}
93+
{% include "partials/javascripts/palette.html" %}
94+
{% endif %}
95+
96+
<!-- Site language selector -->
97+
{% if config.extra.alternate %}
98+
{% include "partials/alternate.html" %}
99+
{% endif %}
100+
101+
<!-- Button to open search modal -->
102+
{% if "material/search" in config.plugins %}
103+
{% set search = config.plugins["material/search"] | attr("config") %}
104+
105+
<!-- Check if search is actually enabled - see https://t.ly/DT_0V -->
106+
{% if search.enabled %}
107+
<label class="md-header__button md-icon" for="__search">
108+
{% set icon = config.theme.icon.search or "material/magnify" %}
109+
{% include ".icons/" ~ icon ~ ".svg" %}
110+
</label>
111+
112+
<!-- Search interface -->
113+
{% include "partials/search.html" %}
114+
{% endif %}
115+
{% endif %}
116+
117+
<!-- Repository information -->
118+
{% if config.repo_url %}
119+
<div class="md-header__source">
120+
{% include "partials/source.html" %}
121+
</div>
122+
{% endif %}
123+
</nav>
124+
125+
<!-- Navigation tabs (sticky) -->
126+
{% if "navigation.tabs.sticky" in features %}
127+
{% if "navigation.tabs" in features %}
128+
{% include "partials/tabs.html" %}
129+
{% endif %}
130+
{% endif %}
131+
</header>

docs/hooks/mkdocs_hooks.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import importlib.metadata
2+
3+
4+
def on_config(config):
5+
"""
6+
This is for injecting the package version into mkdocs
7+
config so it can be used in templates.
8+
"""
9+
config["extra"]["site_version"] = importlib.metadata.version("planet-auth")
10+
return config

docs/img/logo-color-dark-150.png

7.27 KB
Loading

0 commit comments

Comments
 (0)