Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/actions/setup-aswfdocker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (c) Contributors to the aswf-docker Project. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Installs uv, Python and aswfdocker with its dependencies, shared by every
# workflow job running aswfdocker. Workflows reference it as
# `$/.github/actions/setup-aswfdocker`, so it is read from the commit the
# workflow runs from, not from the checkout: release workflows building an
# older commit still get this setup. It installs the checked-out project, so
# actions/checkout must run first.
name: Set up aswfdocker
description: Install uv, Python and aswfdocker with its dependencies

inputs:
dev:
description: Also install the dev dependencies ("true" or "false")
required: false
default: "false"

runs:
using: composite
steps:
- name: Install uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
enable-cache: auto

- name: Set up Python
shell: bash
run: uv python install 3.10

- name: Install aswfdocker and dependencies
if: ${{ inputs.dev != 'true' }}
shell: bash
run: uv sync --frozen

- name: Install aswfdocker and dev dependencies
if: ${{ inputs.dev == 'true' }}
shell: bash
run: uv sync --all-extras --frozen
9 changes: 9 additions & 0 deletions .github/jactionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) Contributors to the aswf-docker Project. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# jactionlint configuration (run by pre-commit, see CONTRIBUTING.md).
# jactionlint checks the correctness of workflows and actions; their
# security is audited by zizmor, so only the correctness profile is used,
# leaving out jactionlint's security and policy rules (which follow
# zizmor's audits) to avoid every finding and ignore comment twice.
profile: correctness
102 changes: 102 additions & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Copyright (c) Contributors to the aswf-docker Project. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Checks a release's inputs, for the release workflows to call before the
# jobs holding the Artifactory or Docker Hub credentials. Runs as its own
# job, which gets no secrets.
#
# In particular, the commit must be on a branch of this repository (main, or
# a release branch for maintenance releases): GitHub serves any commit of
# the fork network through this repository, so without this check a commit
# only pushed to a fork could be released.
name: Check Release

on:
workflow_call:
inputs:
sha:
description: Full SHA of the commit to release
required: true
type: string
org:
description: Docker organization and Conan user to release to (aswf or aswftesting)
required: true
type: string
groups:
description: Space-separated groups
required: true
type: string
versions:
description: Space-separated versions
required: true
type: string
targets:
description: Space-separated targets
required: false
type: string
default: ""
outputs:
versions:
description: The versions as a JSON array, for a per-version matrix
value: ${{ jobs.check-release.outputs.versions }}

permissions:
contents: read

jobs:
check-release: # zizmor: ignore[concurrency-limits] a concurrency group would cancel queued releases
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.check-inputs.outputs.versions }}
steps:
# Inputs go through the environment rather than being expanded into
# scripts, and are checked before anything uses them.
- name: Check inputs
id: check-inputs
env:
SHA: ${{ inputs.sha }}
ORG: ${{ inputs.org }}
GROUPS_INPUT: ${{ inputs.groups }}
VERSIONS: ${{ inputs.versions }}
TARGETS: ${{ inputs.targets }}
run: |
set -euo pipefail
if [[ ! "$SHA" =~ ^[0-9a-f]{40}$ ]]; then
echo "::error::sha must be a full 40-character commit SHA: $SHA"
exit 1
fi
if [[ "$ORG" != "aswf" && "$ORG" != "aswftesting" ]]; then
echo "::error::org must be aswf or aswftesting: $ORG"
exit 1
fi
for input in "$GROUPS_INPUT" "$VERSIONS" "$TARGETS"; do
if [[ ! "$input" =~ ^[A-Za-z0-9._\ -]*$ ]]; then
echo "::error::Invalid input: $input"
exit 1
fi
done
if [[ -z "${GROUPS_INPUT// }" || -z "${VERSIONS// }" ]]; then
echo "::error::groups and versions must not be empty"
exit 1
fi
echo "versions=$(jq -cn --arg v "$VERSIONS" '$v | split(" ") | map(select(. != ""))')" >> "$GITHUB_OUTPUT"

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.sha }}
# All branches, for the check below.
fetch-depth: 0
persist-credentials: false

- name: Check the commit is on a branch of ${{ github.repository }}
env:
SHA: ${{ inputs.sha }}
run: |
set -euo pipefail
branches=$(git branch --remotes --contains "$SHA")
if [[ -z "$branches" ]]; then
echo "::error::Commit $SHA is not on any branch of $GITHUB_REPOSITORY"
exit 1
fi
echo "Commit $SHA is on:"
echo "$branches"
Loading
Loading