Skip to content

Commit

Permalink
ci: Use release-charm.yaml in publish job
Browse files Browse the repository at this point in the history
  • Loading branch information
orfeas-k committed Sep 20, 2024
1 parent af72942 commit e11e325
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
- kfp-viz
with:
cache: ${{ github.event_name == 'pull_request' }}
charmcraft-snap-channel: 2.x/edge
charmcraft-snap-channel: 3.x/edge
path-to-charm-directory: ./charms/${{ matrix.charm }}


Expand Down
1 change: 1 addition & 0 deletions .github/workflows/on_pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ jobs:
publish-charm:
name: Publish Charm
uses: ./.github/workflows/publish.yaml
needs: tests
secrets: inherit
40 changes: 22 additions & 18 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ jobs:
run: bash .github/workflows/get-charm-paths.sh


publish-charm:
name: Publish Charm
define-channel:
name: Define destination channel
runs-on: ubuntu-20.04
needs: get-charm-paths
strategy:
fail-fast: false
matrix:
charm-path: ${{ fromJson(needs.get-charm-paths.outputs.charm_paths_list) }}
outputs:
destination-channel: ${{ steps.parse-inputs.outputs.destination_channel }}

steps:
- name: Checkout
Expand All @@ -72,17 +70,6 @@ jobs:
echo "setting output of destination_channel=$destination_channel"
echo "::set-output name=destination_channel::$destination_channel"
# tag_prefix
# if charm_path = ./ --> tag_prefix = '' (null)
# if charm_path != ./some-charm (eg: a charm in a ./charms dir) --> tag_prefix = 'some-charm'
if [ ${{ matrix.charm-path }} == './' ]; then
tag_prefix=''
else
tag_prefix=$(basename ${{ matrix.charm-path }} )
fi
echo "setting output of tag_prefix=$tag_prefix"
echo "::set-output name=tag_prefix::$tag_prefix"
- name: Upload charm to charmhub
uses: canonical/charming-actions/[email protected]
with:
Expand All @@ -92,4 +79,21 @@ jobs:
channel: ${{ steps.parse-inputs.outputs.destination_channel }}
tag-prefix: ${{ steps.parse-inputs.outputs.tag_prefix }}
# Pinned to 3.x/stable due to https://github.com/canonical/charmcraft/issues/1845
charmcraft-channel: 3.x/stable
charmcraft-channel: 3.x/stableZ

release:
name: Release charm
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
needs: [define-channel, get-charm-paths]
strategy:
fail-fast: false
matrix:
charm-path: ${{ fromJson(needs.get-charm-paths.outputs.charm_paths_list) }}
with:
channel: ${{ needs.define-channel.outputs.destination-channel }}
artifact-prefix: packed-charm-cache-true-.-charms-${{ matrix.charm-path }}
create-github-release: ${{ github.event_name == 'push' }}
secrets:
charmhub-token: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
permissions:
contents: write # Needed to create GitHub release

0 comments on commit e11e325

Please sign in to comment.