Skip to content

[PRA-264] Fix TIOBE workflow (#212) (#215) #172

[PRA-264] Fix TIOBE workflow (#212) (#215)

[PRA-264] Fix TIOBE workflow (#212) (#215) #172

Workflow file for this run

# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
name: Release to Charmhub edge
on:
push:
branches:
- 3.4/edge
- 3.5/edge
permissions:
contents: read
jobs:
release-checks:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Extract branch metadata
shell: bash
run: |
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
echo "risk=${BRANCH##*\/}" >> $GITHUB_OUTPUT
echo "track=${BRANCH%*\/*}" >> $GITHUB_OUTPUT
id: branch_metadata
- name: Install rockcraft
run: sudo snap install rockcraft --classic
- name: Extract metadata
shell: bash
run: |
IMAGE_URI=$(yq '.resources.kyuubi-image.upstream-source' metadata.yaml)
VERSION=$(rockcraft.skopeo inspect "docker://${IMAGE_URI}" | jq -r '.Labels["org.opencontainers.image.version"] | split(".")[:2] | join(".")')
BASE=$(yq '.platforms' charmcraft.yaml | sed -n "s/ubuntu\@\([0-9\.]*\)\:.*/\1/p" | tail -n1)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "base=${BASE}" >> $GITHUB_OUTPUT
id: charm_metadata
- name: Check consistency between metadata and release branch
shell: bash
run: |
RAW_VERSION=${{ steps.charm_metadata.outputs.version }}
MAJOR_MINOR_VERSION=$(echo $RAW_VERSION | sed -n "s/\(^[0-9]*\.[0-9]*\).*/\1/p")
if [ "${MAJOR_MINOR_VERSION}" != "${{ steps.branch_metadata.outputs.track }}" ]; then exit 1; fi
# The publishing pipeline does not work for other risk than edge. The DP workflows below
# is constraint to work with edge
if [ "edge" != "${{ steps.branch_metadata.outputs.risk }}" ]; then exit 1; fi
continue-on-error: false
outputs:
branch: ${{ steps.branch_metadata.outputs.branch }}
track: ${{ steps.branch_metadata.outputs.track }}
risk: ${{ steps.branch_metadata.outputs.risk }}
base: ${{ steps.charm_metadata.outputs.base }}
version: ${{ steps.charm_metadata.outputs.version }}
tag:
needs:
- release-checks
name: Create charm refresh compatibility version git tag
uses: canonical/data-platform-workflows/.github/workflows/tag_charm_edge.yaml@v48.1.1
with:
track: ${{ needs.release-checks.outputs.track }}
permissions:
actions: read # Needed for GitHub API call to get workflow version
contents: write # Needed to create git tags
ci-tests:
uses: ./.github/workflows/ci.yaml
needs:
- tag
secrets: inherit
permissions:
actions: read
contents: read
release:
name: Release charm
needs:
- ci-tests
- release-checks
uses: canonical/data-platform-workflows/.github/workflows/release_charm_edge.yaml@v48.1.1
with:
track: ${{ needs.release-checks.outputs.track }}
artifact-prefix: ${{ needs.ci-tests.outputs.artifact-prefix }}
secrets:
charmhub-token: ${{ secrets.CHARMHUB_TOKEN }}
permissions:
actions: read # Needed for GitHub API call to get workflow version
contents: write # Needed to create git tags