Skip to content

Commit

Permalink
fix: Manage legacy docker building on Workflows
Browse files Browse the repository at this point in the history
Co-Authored-By: Sebastián Vargas <sebastian.varbel@gmail.com>
  • Loading branch information
achetronic and sebastocorp committed Jun 12, 2024
1 parent 23a576b commit 4385b62
Showing 1 changed file with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions .github/workflows/release-docker-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,32 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- id: read_tag
name: Read release tag name (mostly vx.x.x)
run: |
if [ "${{ github.event_name }}" = "release" ]; then
export TAG="${{ github.ref_name }}"
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
export TAG="${{ inputs.release }}"
fi
echo "release_tag=${TAG}" >> "$GITHUB_OUTPUT"
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ steps.read_tag.outputs.release_tag }}

- name: Read Go version from go.mod
id: read_go_version
run: |
go_version_raw=$(grep "^go " go.mod | awk '{print $2}')
echo "go_version=${go_version_raw}" >> "$GITHUB_OUTPUT"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: '${{ steps.read_go_version.outputs.go_version }}'

- name: Set up QEMU
id: qemu
Expand All @@ -45,13 +64,17 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
- id: build
name: Build and push Docker images
env:
RELEASE_TAG: ${{ steps.read_tag.outputs.release_tag }}
run: |
if [ "${{ github.event_name }}" = "release" ]; then
export TAG="${{ github.ref_name }}"
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
export TAG="${{ inputs.release }}"
export IMG="ghcr.io/$GITHUB_REPOSITORY:$RELEASE_TAG"
if grep -q '^docker-buildx:' Makefile; then
make docker-buildx
else
make docker-build
make docker-push
fi
export IMG="ghcr.io/$GITHUB_REPOSITORY:$TAG"
make docker-buildx

0 comments on commit 4385b62

Please sign in to comment.