Merge pull request #276 from canonical/release-please--branches--trac… #25
Workflow file for this run
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
# reusable workflow for publishing all charms in this repo | |
name: Publish | |
on: | |
push: | |
tags: | |
- "v**" | |
- "track**" | |
workflow_dispatch: | |
inputs: | |
destination_channel: | |
description: CharmHub channel to publish to | |
required: false | |
default: 'latest/edge' | |
type: string | |
source_branch: | |
description: Github branch from this repo to publish. If blank, will use the default branch | |
required: false | |
default: '' | |
type: string | |
override-ci: | |
description: Override standard release flow | |
required: true | |
type: boolean | |
jobs: | |
publish: | |
name: Publish Charm | |
uses: canonical/identity-team/.github/workflows/charm-publish.yaml@17b1464c20132f69a42ca846cd816715724ea5f3 # v1.4.2 | |
with: | |
destination_channel: ${{ inputs.destination_channel}} | |
source_branch: ${{ inputs.source_branch}} | |
secrets: | |
CHARMCRAFT_CREDENTIALS: ${{ secrets.CHARMCRAFT_CREDENTIALS}} | |
revision: | |
concurrency: | |
group: ${{ needs.publish.outputs.track }}-${{ needs.publish.outputs.channel }} | |
cancel-in-progress: true | |
needs: | |
- publish | |
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: Set charm name | |
id: set-charm-name | |
run: echo charm_name=$(cat charmcraft.yaml | yq '.name') >> $GITHUB_OUTPUT | |
- name: Set 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 == "${{ needs.publish.outputs.channel }}") | .revision') | |
echo "setting output of revision=$revision" | |
echo "revision=$revision" >> $GITHUB_OUTPUT | |
env: | |
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_CREDENTIALS }} | |
CHARM_NAME: ${{ steps.set-charm-name.outputs.charm_name }} | |
# only cater for latest track for now | |
TRACK: latest | |
dev-deploy: | |
concurrency: | |
group: ${{ needs.publish.outputs.track }}-${{ needs.publish.outputs.channel }} | |
cancel-in-progress: true | |
needs: | |
- publish | |
- revision | |
if: ${{ (needs.publish.outputs.channel == 'latest/edge') }} | |
uses: canonical/identity-team/.github/workflows/charm-deploy.yaml@17b1464c20132f69a42ca846cd816715724ea5f3 # v1.4.2 | |
with: | |
model: dev-iam | |
revision: ${{ needs.revision.outputs.revision }} | |
channel: ${{ needs.publish.outputs.channel}} | |
application: hydra | |
secrets: | |
CLIENT_ID: ${{ secrets.JIMM_DEV_CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.JIMM_DEV_CLIENT_SECRET }} | |
JIMM_URL: ${{ secrets.JIMM_URL }} | |
stg-deploy: | |
concurrency: | |
group: ${{ needs.publish.outputs.track }}-${{ needs.publish.outputs.channel }} | |
cancel-in-progress: true | |
needs: | |
- publish | |
- revision | |
if: ${{ (needs.publish.outputs.channel == 'latest/stable') }} | |
uses: canonical/identity-team/.github/workflows/charm-deploy.yaml@17b1464c20132f69a42ca846cd816715724ea5f3 # v1.4.2 | |
with: | |
model: stg-iam | |
revision: ${{ needs.revision.outputs.revision }} | |
channel: ${{ needs.publish.outputs.channel}} | |
application: hydra | |
secrets: | |
CLIENT_ID: ${{ secrets.JIMM_STG_CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.JIMM_STG_CLIENT_SECRET }} | |
JIMM_URL: ${{ secrets.JIMM_URL }} |