Skip to content

Commit

Permalink
Merge pull request #84 from jwagantall/release-docker
Browse files Browse the repository at this point in the history
CI: Add action to verify a release file against an approved schema
  • Loading branch information
jwagantall authored Nov 30, 2023
2 parents 26f3ac3 + e2dadcb commit 2551123
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/actions/verify-release-schema-action/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: "verify-release-schema"
description: "Verify a release file's contents against an approved schema"

inputs:
distribution-type:
description: "The content type of the release"
required: true
release-file:
description: "File that describes the release contents"
required: true

runs:
using: "composite"
steps:
- id: Installing dependencies
run: |
python -m pip install --upgrade pip
pip install lftools
- id: Set release type
# yamllint disable rule:line-length
run: |
if [[ "${{ inputs.distribution-type }}" == "artifact" ]]; then
release_schema="release-artifact-schema.yaml"
elif [[ "${{ inputs.distribution-type }}" == "container" ]]; then
release_schema="release-container-schema.yaml"
elif [[ "${{ inputs.distribution-type }}" == "maven" ]]; then
release_schema="release-schema.yaml"
elif [[ "${{ inputs.distribution-type }}" == "packagecloud" ]]; then
release_schema="release-packagecloud-schema.yaml"
elif [[ "${{ inputs.distribution-type }}" == "pypi" ]]; then
release_schema="release-pypi-schema.yaml"
else
echo "ERROR: distribution_type: ${{ inputs.distribution-type }} not supported"
release_schema="unsupported"
fi
echo "INFO: Schema to compare: $release_schema"
echo "USE_SCHEMA=$release_schema" >> "$GITHUB_ENV"
# yamllint enable rule:line-length
- id: Download and compare schema
# yamllint disable rule:line-length
if: ${{ env.USE_SCHEMA != "unsupported" }}
run: |
echo "INFO: Fetching schema ${{ env.USE_SCHEMA }}"
wget -q https://raw.githubusercontent.com/lfit/releng-global-jjb/master/schema/${{ env.USE_SCHEMA }}
echo "INFO: Verifying ${{ inputs.release_file }} against schema ${{ env.USE_SCHEMA }}"
lftools schema verify "${{ inputs.release_file }}" "${{ env.USE_SCHEMA }}"
# yamllint enable rule:line-length

0 comments on commit 2551123

Please sign in to comment.