Skip to content

Commit

Permalink
Improve the workflow for publishing images
Browse files Browse the repository at this point in the history
- Only run this workflow when we push a new image tag
- Get the image version from the tag instead of hardcoding it
  • Loading branch information
andrewn617 committed Mar 27, 2024
1 parent 4b2aa43 commit 7b79e93
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build-and-publish-images.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Build and Publish Images

on:
workflow_dispatch:
push:
tags: [ 'ruby-*.*.*' ]

jobs:
build:
Expand Down Expand Up @@ -44,6 +45,9 @@ jobs:
with:
platforms: linux/amd64,linux/arm64

- name: Set Image version env variable
run: echo "IMAGE_VERSION=$(echo ${{ github.ref_name }} | tr -d ruby-)" >> $GITHUB_ENV

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand All @@ -58,7 +62,7 @@ jobs:
BUILDX_NO_DEFAULT_ATTESTATIONS: true
with:
imageName: ghcr.io/rails/devcontainer/images/ruby
imageTag: 0.3.0-${{ matrix.RUBY_VERSION }},${{ matrix.RUBY_VERSION }}
imageTag: ${{ env.IMAGE_VERSION }}-${{ matrix.RUBY_VERSION }},${{ matrix.RUBY_VERSION }}
subFolder: images/ruby
push: always
platform: linux/amd64,linux/arm64

0 comments on commit 7b79e93

Please sign in to comment.