-
-
Notifications
You must be signed in to change notification settings - Fork 533
81 lines (71 loc) · 2.68 KB
/
build_images.yml
File metadata and controls
81 lines (71 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: "Build & push devcontainer"
on:
push:
branches:
- master
paths:
- .devcontainer/**
- .github/workflows/build_images.yml
# Uncomment if you want to test things out in a PR
#
# pull_request:
# paths:
# - .devcontainer/**
# - .github/workflows/build_images.yml
permissions:
contents: read
packages: write # Required for GHCR
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
ruby_image:
- ruby:2.7.8-slim-bullseye
- ruby:3.0.7-slim-bullseye
- ruby:3.1.7-slim-bookworm
- ruby:3.2.9-slim-trixie
- ruby:3.3.10-slim-trixie
- ruby:3.4.8-slim-trixie
- ruby:4.0.0-slim-trixie
steps:
- name: Check out current commit
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Generate short image name and extract version
id: image_name
run: |
ruby_image="${{ matrix.ruby_image }}"
# Extract full version for GEM_HOME (e.g., ruby:3.4.5-slim-bookworm -> 3.4.5)
if [[ "$ruby_image" == ruby:* ]]; then
full_version=$(echo "$ruby_image" | cut -d: -f2 | cut -d- -f1)
version=$(echo "$ruby_image" | cut -d: -f2 | cut -d. -f1,2)
short_name="sentry-ruby-devcontainer-${version}"
elif [[ "$ruby_image" == jruby:latest ]]; then
full_version="latest"
short_name="sentry-ruby-devcontainer-jruby-latest"
elif [[ "$ruby_image" == jruby:* ]]; then
full_version=$(echo "$ruby_image" | cut -d: -f2 | cut -d- -f1)
version=$(echo "$ruby_image" | cut -d: -f2 | cut -d. -f1,2)
short_name="sentry-ruby-devcontainer-jruby-${version}"
else
full_version="latest"
short_name="sentry-ruby-devcontainer-${ruby_image}"
fi
echo "short_name=${short_name}" >> $GITHUB_OUTPUT
echo "full_version=${full_version}" >> $GITHUB_OUTPUT
echo "Generated short image name: ${short_name}"
echo "Extracted full version: ${full_version}"
- name: Build and push devcontainer image
id: build
uses: getsentry/action-build-and-push-images@8fc75e483c09a68721f2c8951292ee17f8821766 # main
with:
image_name: "${{ steps.image_name.outputs.short_name }}"
dockerfile_path: ".devcontainer/Dockerfile"
ghcr: true
publish_on_pr: true
build_args: |
IMAGE=${{ matrix.ruby_image }}
VERSION=${{ steps.image_name.outputs.full_version }}
- name: Use outputs
run: |
echo "GHCR URL: ${{ steps.build.outputs.ghcr_image_url }}"