|
6 | 6 | - main |
7 | 7 |
|
8 | 8 | jobs: |
| 9 | + pack-charm: |
| 10 | + name: Prepare charm for upload |
| 11 | + runs-on: ubuntu-24.04 |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Setup LXD |
| 17 | + uses: canonical/setup-lxd@main |
| 18 | + |
| 19 | + - name: Install charmcraft |
| 20 | + run: sudo snap install charmcraft --classic |
| 21 | + |
| 22 | + - name: Pack charm |
| 23 | + run: charmcraft pack -v |
| 24 | + |
| 25 | + - name: Upload charm artifact |
| 26 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 27 | + with: |
| 28 | + name: charm |
| 29 | + path: ./*.charm |
| 30 | + |
| 31 | + define-matrix: |
| 32 | + name: Define charms upload matrix |
| 33 | + runs-on: ubuntu-24.04 |
| 34 | + needs: |
| 35 | + - pack-charm |
| 36 | + outputs: |
| 37 | + charms: ${{ steps.charms.outputs.charms }} |
| 38 | + steps: |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Download charm artifact(s) |
| 43 | + uses: actions/download-artifact@v4 |
| 44 | + with: |
| 45 | + name: charm |
| 46 | + |
| 47 | + - name: Generate matrix list |
| 48 | + id: charms |
| 49 | + run: | |
| 50 | + list="$(ls *.charm | jq -r -ncR '[input]')" |
| 51 | + echo "charms=$list" |
| 52 | + echo "charms=$list" >> $GITHUB_OUTPUT |
| 53 | +
|
9 | 54 | publish-to-edge: |
10 | | - uses: canonical/operator-workflows/.github/workflows/publish_charm.yaml@main |
11 | | - secrets: inherit |
| 55 | + name: Release to CharmHub |
| 56 | + runs-on: ubuntu-24.04 |
| 57 | + needs: |
| 58 | + - define-matrix |
| 59 | + strategy: |
| 60 | + matrix: |
| 61 | + charm: ${{ fromJSON(needs.define-matrix.outputs.charms) }} |
| 62 | + steps: |
| 63 | + - name: Checkout |
| 64 | + uses: actions/checkout@v4 |
| 65 | + with: |
| 66 | + fetch-depth: 0 |
| 67 | + |
| 68 | + - name: Select charmhub channel |
| 69 | + id: channel |
| 70 | + uses: canonical/charming-actions/[email protected] |
| 71 | + |
| 72 | + - name: Download charm artifact(s) |
| 73 | + uses: actions/download-artifact@v4 |
| 74 | + with: |
| 75 | + name: charm |
| 76 | + |
| 77 | + - name: Upload charm to charmhub |
| 78 | + uses: canonical/charming-actions/[email protected] |
| 79 | + with: |
| 80 | + credentials: "${{ secrets.CHARMHUB_TOKEN }}" |
| 81 | + github-token: "${{ secrets.GITHUB_TOKEN }}" |
| 82 | + channel: "${{ steps.channel.outputs.name }}" |
| 83 | + built-charm-path: "${{ matrix.charm }}" |
0 commit comments