🐛 No comment #5
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: Build-Publish | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| branches: | |
| - test-image-refactor # TODO: Remove after testing | |
| workflow_dispatch: | |
| inputs: | |
| plugin_deps: | |
| description: 'Plugin dependencies to include (comma-separated, e.g., "nemocheck" or "nemo,nemocheck")' | |
| required: false | |
| default: 'nemocheck' | |
| permissions: {} | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6 | |
| - name: Build protobufs | |
| run: USE_HTTPS=true ./proto-build.sh | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 | |
| - name: Log in to ghcr.io | |
| uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set plugin deps and image suffix | |
| id: plugin_deps | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| DEPS="${{ github.event.inputs.plugin_deps }}" | |
| else | |
| DEPS="nemocheck" | |
| fi | |
| echo "deps=$DEPS" >> $GITHUB_OUTPUT | |
| # Normalize plugin deps for image suffix (replace commas with hyphens) | |
| # Examples: | |
| # "nemocheck" -> "nemocheck" | |
| # "nemo,nemocheck" -> "nemo-nemocheck" | |
| SUFFIX=$(echo "$DEPS" | tr ',' '-') | |
| echo "suffix=$SUFFIX" >> $GITHUB_OUTPUT | |
| # Example resulting image names: | |
| # For tag v1.0.0 with PLUGIN_DEPS=nemocheck: | |
| # ghcr.io/<repo>/plugins-adapter-nemocheck:v1.0.0 | |
| # ghcr.io/<repo>/plugins-adapter-nemocheck:latest | |
| # For tag v1.0.0 with PLUGIN_DEPS=nemo,nemocheck: | |
| # ghcr.io/<repo>/plugins-adapter-nemo-nemocheck:v1.0.0 | |
| # ghcr.io/<repo>/plugins-adapter-nemo-nemocheck:latest | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6 | |
| with: | |
| images: ghcr.io/${{ github.repository }}/plugins-adapter | |
| flavor: | | |
| suffix=-${{ steps.plugin_deps.outputs.suffix }},onlatest=true | |
| tags: | | |
| type=ref,event=tag | |
| type=ref,event=branch | |
| type=raw,value=latest,enable=${{ github.ref_type == 'tag' }} | |
| - name: Build and push | |
| uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| build-args: PLUGIN_DEPS=${{ steps.plugin_deps.outputs.deps }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |