-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* release to pypi Signed-off-by: Alex Goodman <[email protected]> * port to uv Signed-off-by: Alex Goodman <[email protected]> --------- Signed-off-by: Alex Goodman <[email protected]>
- Loading branch information
Showing
14 changed files
with
1,524 additions
and
1,912 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
tools: | ||
# we want to use a pinned version of binny to manage the toolchain (so binny manages itself!) | ||
- name: binny | ||
version: | ||
want: v0.8.0 | ||
method: github-release | ||
with: | ||
repo: anchore/binny | ||
|
||
# used for showing the changelog at release | ||
- name: glow | ||
version: | ||
want: v2.0.0 | ||
method: github-release | ||
with: | ||
repo: charmbracelet/glow | ||
|
||
# used at release to generate the changelog | ||
- name: chronicle | ||
version: | ||
want: v0.8.0 | ||
method: github-release | ||
with: | ||
repo: anchore/chronicle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: "Bootstrap" | ||
description: "Bootstrap all tools and dependencies" | ||
inputs: | ||
uv-version: | ||
description: "UV version to install" | ||
required: true | ||
default: "0.5.16" | ||
cache-key-prefix: | ||
description: "Prefix all cache keys with this value" | ||
required: true | ||
default: "9c833ef7" | ||
tools: | ||
description: "whether to install tools" | ||
default: "true" | ||
bootstrap-apt-packages: | ||
description: "Space delimited list of tools to install via apt" | ||
default: "" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
enable-cache: true | ||
|
||
- name: "Set up Python" | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version-file: "pyproject.toml" | ||
|
||
- name: Restore tool cache | ||
if: inputs.tools == 'true' | ||
id: tool-cache | ||
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 | ||
with: | ||
path: ${{ github.workspace }}/.tool | ||
key: ${{ inputs.cache-key-prefix }}-${{ runner.os }}-tool-${{ hashFiles('.binny.yaml') }} | ||
|
||
- name: Install project tools | ||
shell: bash | ||
if: inputs.tools == 'true' | ||
run: make tools | ||
|
||
- name: Install apt packages | ||
if: inputs.bootstrap-apt-packages != '' | ||
shell: bash | ||
run: | | ||
DEBIAN_FRONTEND=noninteractive sudo apt update && sudo -E apt install -y ${{ inputs.bootstrap-apt-packages }} | ||
- name: Install project + dependencies | ||
shell: bash | ||
run: uv sync --all-extras --dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
red=$(tput setaf 1) | ||
bold=$(tput bold) | ||
normal=$(tput sgr0) | ||
|
||
# assert we are running in CI (or die!) | ||
if [[ -z "$CI" ]]; then | ||
echo "${bold}${red}This script should ONLY be run in CI. Exiting...${normal}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ permissions: | |
contents: read | ||
|
||
jobs: | ||
|
||
quality-gate: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
|
@@ -42,42 +43,67 @@ jobs: | |
echo "Validations Status: ${{ steps.validations.conclusion }}" | ||
false | ||
release: | ||
needs: [quality-gate] | ||
runs-on: ubuntu-20.04 | ||
environment: release | ||
tag: | ||
needs: | ||
- quality-gate | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: write | ||
packages: write | ||
issues: read | ||
pull-requests: read | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 | ||
with: | ||
# in order to properly resolve the version from git | ||
fetch-depth: 0 | ||
|
||
- name: Restore tool cache | ||
id: tool-cache | ||
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | ||
with: | ||
path: ${{ github.workspace }}/.tmp | ||
key: ${{ runner.os }}-tool-${{ hashFiles('Makefile') }} | ||
|
||
- name: (cache-miss) Bootstrap tools | ||
if: steps.tool-cache.outputs.cache-hit != 'true' | ||
run: make bootstrap | ||
|
||
- name: Tag release | ||
run: | | ||
git config --global user.name "anchoreci" | ||
git config --global user.email "[email protected]" | ||
git tag -a ${{ github.event.inputs.version }} -m "Release ${{ github.event.inputs.version }}" | ||
git tag ${{ github.event.inputs.version }} | ||
git push origin --tags | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release-pypi: | ||
needs: | ||
- tag | ||
runs-on: ubuntu-22.04 | ||
environment: release | ||
permissions: | ||
contents: read | ||
# required to authenticate with PyPI via OIDC token | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 | ||
with: | ||
# in order to properly resolve the version from git | ||
fetch-depth: 0 | ||
|
||
- name: Bootstrap environment | ||
uses: ./.github/actions/bootstrap | ||
|
||
# note: authentication is via the OIDC token | ||
- name: Publish to PyPI | ||
run: make ci-publish-pypi | ||
|
||
release-github: | ||
needs: | ||
- tag | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: write | ||
packages: write | ||
issues: read | ||
pull-requests: read | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 | ||
with: | ||
# in order to properly resolve the version from git | ||
fetch-depth: 0 | ||
|
||
- name: Bootstrap environment | ||
uses: ./.github/actions/bootstrap | ||
|
||
- name: Create github release | ||
run: | | ||
make changelog | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ CHANGELOG.md | |
VERSION | ||
.tmp/ | ||
.tool-versions | ||
.mise.toml | ||
.tool | ||
|
||
.idea/ | ||
.vscode/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.