Skip to content

ci: Publish bundle to charmhub #62

ci: Publish bundle to charmhub

ci: Publish bundle to charmhub #62

name: Publish bundle to Charmhub
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 }}
output-json:
name: output fromJson
runs-on: ubuntu-22.04
needs: [get-releases-affected]
steps:
- name: output
run: |
echo ${{ needs.get-releases-affected.outputs.releases_affected }}
x=${{ fromJson(needs.get-releases-affected.outputs.releases_affected) }}
echo ${x[*]}
run-tests-and-publish-bundle-for-releases-affected:
name: Run bundle tests for releases affected and publish bundle to corresponding Charmhub channels
uses: ./.github/workflows/run-tests-and-publish-bundle.yaml
needs: [get-releases-affected]
strategy:
fail-fast: false
matrix:
release: ${{ fromJson(needs.get-releases-affected.outputs.releases_affected) }}
with:
release: ${{ matrix.release }}
# runs-on: ubuntu-22.04
# 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/actions/full-bundle-tests
# with:
# bundle-test-path: ${{ steps.bundle-test-path.outputs.bundle_test_path }}
# bundle-source: --file ${{ steps.bundle-path.outputs.bundle_path }}/bundle.yaml
# dockerhub-user: ${{ secrets.MAKSIM_DOCKERHUB_PASSWORD }}
# dockerhub-password: ${{ secrets.MAKSIM_DOCKERHUB_PASSWORD }}
# github-token: ${{ secrets.GITHUB_TOKEN}}
# - name: Publish bundle for release ${{ matrix.release }} to Charmhub
# uses: canonical/charming-actions/upload-bundle@1.0.0
# with:
# credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
# github-token: ${{ secrets.GITHUB_TOKEN }}
# bundle-path: ${{ steps.bundle-path.outputs.bundle_path }}
# channel: ${{ matrix.release }}/test-branch