chore(devcontainer): add latest git via feature (#2956) #67
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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Read devcontainer version | |
| id: version | |
| run: echo "version=$(cat .devcontainer/VERSION)" >> $GITHUB_OUTPUT | |
| - name: Log in to GHCR | |
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3 | |
| - name: Build and push devcontainer image | |
| uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6 | |
| with: | |
| context: . | |
| file: .devcontainer/Dockerfile | |
| push: true | |
| tags: | | |
| ghcr.io/getsentry/sentry-ruby-devcontainer-${{ matrix.flavor }}:${{ steps.version.outputs.version }} | |
| ${{ github.ref == 'refs/heads/master' && format('ghcr.io/getsentry/sentry-ruby-devcontainer-{0}:latest', matrix.flavor) || '' }} | |
| build-args: | | |
| BASE_IMAGE=${{ matrix.base_image }} | |
| RUBY_VERSION=${{ matrix.ruby_version }} | |
| cache-from: type=gha,scope=${{ matrix.flavor }} | |
| cache-to: type=gha,mode=max,scope=${{ matrix.flavor }} |