Merge pull request #3 from DefactoSoftware/add-openssh-client #6
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 and publish | |
| # Builds each version directory as `defactosoftware/elixir:<dir-name>` and | |
| # publishes to Docker Hub on merge to master. PR runs build-only (no push) so | |
| # Dockerfile regressions surface before merge. | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - "*/Dockerfile" | |
| - ".github/workflows/publish.yml" | |
| pull_request: | |
| paths: | |
| - "*/Dockerfile" | |
| - ".github/workflows/publish.yml" | |
| workflow_dispatch: | |
| # Opt every job into the Node.js 24 runtime ahead of GitHub's 2026-06-02 | |
| # default-flip, so we catch any action incompatibility on our own schedule | |
| # rather than during a real publish. Safe to remove once Node 24 is the | |
| # runner default. | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" | |
| jobs: | |
| detect-versions: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| versions: ${{ steps.set.outputs.versions }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: set | |
| run: | | |
| versions=$(find . -mindepth 2 -maxdepth 2 -name Dockerfile \ | |
| | sed -E 's|^\./([^/]+)/Dockerfile$|\1|' \ | |
| | sort \ | |
| | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| echo "versions=$versions" >> "$GITHUB_OUTPUT" | |
| echo "Detected: $versions" | |
| build: | |
| needs: detect-versions | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.detect-versions.outputs.versions) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./${{ matrix.version }} | |
| platforms: linux/amd64 | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: defactosoftware/elixir:${{ matrix.version }} | |
| cache-from: type=gha,scope=${{ matrix.version }} | |
| cache-to: type=gha,scope=${{ matrix.version }},mode=max |