Skip to content

ci: Publish bundle to charmhub #34

ci: Publish bundle to charmhub

ci: Publish bundle to charmhub #34

name: Publish bundle for releases affected to corresponding Charmhub channels
on:
push:
branches:
- main
paths:
- releases/**
# only for testing purposes
pull_request:
paths:
- releases/**
jobs:
get-releases-affected:
name: Get releases affected
runs-on: ubuntu-22.04
outputs:
releases_affected: ${{ steps.get-releases-affected.outputs.releases_affected_json }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get files changed
id: changed-files
uses: tj-actions/changed-files@v37
- name: Get releases affected
id: get-releases-affected
run: python scripts/get_releases_affected.py ${{ steps.changed-files.outputs.all_changed_files }}
# run-tests-for-releases-affected:
# name: Run bundle tests for releases affected
# runs-on: ubuntu-22.04
# needs: [get-releases-affected]
# strategy:
# fail-fast: false
# matrix:
# release: ${{ fromJson(needs.get-releases-affected.outputs.releases_affected) }}
# uses:
run-tests-and-publish-bundle-for-releases-affected:
name: Run bundle tests for releases affected and publish bundle to corresponding Charmhub channels
runs-on: ubuntu-22.04
needs: [get-releases-affected]
strategy:
fail-fast: false
matrix:
release: ${{ fromJson(needs.get-releases-affected.outputs.releases_affected) }}
steps:
- uses: actions/checkout@v3
- name: Get bundle path for current release
id: bundle-path
run: python scripts/get_bundle_path.py ${{ matrix.release }}
- name: Get bundle test path for current release
id: bundle-tests-path
run: python scripts/get_bundle_test_path.py ${{ matrix.release }}
- name: Run tests for bundle release ${{ matrix.release }}
uses: ./.github/workflows/full-bundle-tests.yaml/
with:
bundle-test-path: ${{ steps.bundle-test-path.outputs.bundle_test_path }}
bundle-source: --file ${{ steps.bundle-path.outputs.bundle_path }}/bundle.yaml
- name: Publish bundle for release ${{ matrix.release }} to Charmhub
uses: canonical/charming-actions/[email protected]
with:
credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
github-token: ${{ secrets.GITHUB_TOKEN }}
bundle-path: ${{ steps.bundle-path.outputs.bundle_path }}
channel: ${{ matrix.release }}/test-branch