Skip to content

Release charm to other tracks and channels #12

Release charm to other tracks and channels

Release charm to other tracks and channels #12

Workflow file for this run

# reusable workflow triggered manually
name: Release charm to other tracks and channels
on:
workflow_dispatch:
inputs:
destination-channel:
description: 'Destination Channel'
required: true
origin-channel:
description: 'Origin Channel'
required: true
jobs:
promote-charm:
name: Promote charm
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Release charm to channel
uses: canonical/charming-actions/release-charm@934193396735701141a1decc3613818e412da606 # 2.6.3
with:
credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
github-token: ${{ secrets.GITHUB_TOKEN }}
destination-channel: ${{ github.event.inputs.destination-channel }}
origin-channel: ${{ github.event.inputs.origin-channel }}
base-channel: '22.04'
revision:
concurrency:
group: ${{ github.event.inputs.destination-channel }}
cancel-in-progress: true
needs: promote-charm
outputs:
revision: ${{ steps.set-revision.outputs.revision }}
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Get revision
id: set-revision
run: |
sudo snap install charmcraft --classic --channel latest/stable
revision=$(charmcraft status ${{ env.CHARM_NAME }} --format json | jq '.[] | select(.track == "${{ env.TRACK }}") | .mappings[0].releases[] | select(.channel == "${{ github.event.inputs.destination-channel }}") | .revision')
echo "setting output of revision=$revision"
echo "revision=$revision" >> $GITHUB_OUTPUT
env:
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
CHARM_NAME: hydra
# only cater for latest track for now
TRACK: latest
dev-deploy:
concurrency:
group: ${{ github.event.inputs.destination-channel }}
cancel-in-progress: true
needs:
- promote-charm
- revision
if: ${{ (github.event.inputs.destination-channel == 'latest/edge') }}
uses: ./.github/workflows/_deploy.yaml
secrets:
CLIENT_ID: ${{ secrets.JIMM_DEV_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.JIMM_DEV_CLIENT_SECRET }}
JIMM_URL: ${{ secrets.JIMM_URL }}
with:
model: dev-iam
revision: ${{ needs.revision.outputs.revision }}
stg-deploy:
concurrency:
group: ${{ github.event.inputs.destination-channel }}
cancel-in-progress: true
needs:
- promote-charm
- revision
if: ${{ (github.event.inputs.destination-channel == 'latest/stable') }}
uses: ./.github/workflows/_deploy.yaml
secrets:
CLIENT_ID: ${{ secrets.JIMM_STG_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.JIMM_STG_CLIENT_SECRET }}
JIMM_URL: ${{ secrets.JIMM_URL }}
with:
model: stg-iam
revision: ${{ needs.revision.outputs.revision }}