fix: narrow the scope of system:cos
#529
This file contains hidden or 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
| name: Publish Charms to 1.xx/edge | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - release-* | |
| jobs: | |
| configure-channel: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| track: ${{ steps.channel.outputs.track }} | |
| risk: ${{ steps.channel.outputs.risk }} | |
| steps: | |
| - name: Determine Channel | |
| id: channel | |
| env: | |
| BRANCH: ${{ github.base_ref || github.ref }} | |
| run: | | |
| BRANCH=${BRANCH#refs/heads/} # strip off refs/heads/ if it exists | |
| if [[ "${BRANCH}" == "main" ]]; then | |
| echo "track=latest" >> "$GITHUB_OUTPUT" | |
| echo "risk=edge" >> "$GITHUB_OUTPUT" | |
| elif [[ "${BRANCH}" =~ ^release-[0-9]+\.[0-9]+$ ]]; then | |
| echo "track=${BRANCH:8}" >> "$GITHUB_OUTPUT" | |
| echo "risk=beta" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "::error Failed to determine track/risk from branch ${BRANCH}" | |
| exit 1 | |
| fi | |
| charmcraft-channel: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| channel: ${{ steps.charmcraft.outputs.channel }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Read charmcraft version file | |
| id: charmcraft | |
| run: echo "channel=$(cat .charmcraft-channel)" >> $GITHUB_OUTPUT | |
| publish-to-edge: | |
| needs: [configure-channel, charmcraft-channel] | |
| uses: canonical/operator-workflows/.github/workflows/publish_charm.yaml@main | |
| strategy: | |
| matrix: | |
| charm: | |
| - { path: ./charms/worker/k8s/, tagPrefix: k8s } | |
| - { path: ./charms/worker/, tagPrefix: k8s-worker } | |
| arch: | |
| - amd64 | |
| - arm64 | |
| secrets: inherit | |
| with: | |
| channel: ${{needs.configure-channel.outputs.track}}/${{needs.configure-channel.outputs.risk}} | |
| charmcraft-channel: ${{ needs.charmcraft-channel.outputs.channel }} | |
| identifier: ${{matrix.arch}} | |
| publish-libs: false | |
| publish-docs: false | |
| tag-prefix: ${{ matrix.charm.tagPrefix }} | |
| working-directory: ${{ matrix.charm.path }} |