Build & push devcontainer #78
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
| name: "Build & push devcontainer" | |
| on: | |
| # This works only on the default branch. To trigger it in a topic branch: | |
| # | |
| # gh workflow run build_images.yml --repo getsentry/sentry-ruby --ref your-branch | |
| # | |
| # IMPORTANT: update `.devcontainer/VERSION` for a topic branch build | |
| # | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - .devcontainer/** | |
| - .github/workflows/build_images.yml | |
| permissions: | |
| contents: read | |
| packages: write # Required for GHCR | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - flavor: "4.0" | |
| base_image: ubuntu:24.04 | |
| ruby_version: "4.0.3" | |
| - flavor: "3.4" | |
| base_image: ubuntu:24.04 | |
| ruby_version: "3.4.9" | |
| - flavor: "2.7" | |
| base_image: ubuntu:22.04 | |
| ruby_version: "2.7.8" | |
| steps: | |
| - name: Check out current commit | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Read devcontainer version | |
| id: version | |
| run: echo "version=$(cat .devcontainer/VERSION)" >> $GITHUB_OUTPUT | |
| - name: Log in to GHCR | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 | |
| # Build with the dev container CLI (not a plain `docker build`) so the dev | |
| # container features — mise and the local `tools` feature that bakes the | |
| # Ruby/Node/Java/Chromium toolchain — are applied to the pushed image. | |
| # BASE_IMAGE and RUBY_VERSION are consumed via ${localEnv:...} in | |
| # devcontainer.json, so they are passed as env vars to the CLI here. | |
| - name: Build and push devcontainer image | |
| uses: devcontainers/ci@513af61f4de4f75d37e4438f184ba4358f0fc1ca # v0.3.1900000450 | |
| env: | |
| BASE_IMAGE: ${{ matrix.base_image }} | |
| RUBY_VERSION: ${{ matrix.ruby_version }} | |
| with: | |
| subFolder: . | |
| configFile: .devcontainer/devcontainer.json | |
| imageName: ghcr.io/getsentry/sentry-ruby-devcontainer-${{ matrix.flavor }} | |
| imageTag: ${{ github.ref == 'refs/heads/master' && format('{0},latest', steps.version.outputs.version) || steps.version.outputs.version }} | |
| push: always |