fix: update target docker-bake file #3
Workflow file for this run
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
| # Copyright AGNTCY Contributors (https://github.com/agntcy) | |
| # SPDX-License-Identifier: Apache-2.0 | |
| --- | |
| name: ci-release-api-image | |
| on: | |
| push: | |
| tags: | |
| - 'api-v*' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| prepare-build: | |
| name: Prepare Build | |
| outputs: | |
| targets: ${{ steps.all-targets.outputs.targets }} | |
| image-tag: ${{ steps.resolve.outputs.version }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Filter target | |
| id: resolve | |
| run: | | |
| # This assumes tags are in this form | |
| # api-v<version> | |
| _target=api | |
| target=${_target%-v*} | |
| # get version only | |
| version=${_target##*-v} | |
| # set target and version as output | |
| echo target=${target} >> ${GITHUB_OUTPUT} | |
| echo version=${version} >> ${GITHUB_OUTPUT} | |
| # Print the target and version | |
| echo "Target: $target" | |
| echo "Version: $version" | |
| - name: List all targets | |
| id: all-targets | |
| uses: docker/bake-action/subaction/list-targets@37816e747588cb137173af99ab33873600c46ea8 # v6.8.0 | |
| with: | |
| target: ${{ steps.resolve.outputs.target }} | |
| continue-on-error: true | |
| build-push: | |
| name: Build docker image - ${{ matrix.target }} | |
| needs: [prepare-build] | |
| if: ${{ needs.prepare-build.outputs.targets != '[]' && needs.prepare-build.outputs.targets != '' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: ${{ fromJson(needs.prepare-build.outputs.targets) }} | |
| uses: ./.github/workflows/reusable-docker-build-push.yaml | |
| permissions: | |
| contents: 'read' | |
| packages: 'write' | |
| attestations: 'write' | |
| with: | |
| bake-targets: ${{ matrix.target }} | |
| image-tag: ${{ needs.prepare-build.outputs.image-tag }} | |
| image-repo: "ghcr.io/agntcy/obs-api" | |
| secrets: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} |