Skip to content

Commit

Permalink
Use docker met version for RELEASE_VERSION (#941)
Browse files Browse the repository at this point in the history
  • Loading branch information
mazay authored Oct 15, 2024
1 parent 923f930 commit 6d4791b
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Run tests
env:
RELEASE_VERSION: ${{ github.event_name == 'release' && github.event.release.tag_name || github.sha }}
RELEASE_VERSION: devel # version doesn't really matter for tests but still has to be set
run: |
cd ./src/github.com/${{ github.repository }}
make test
Expand All @@ -67,6 +67,21 @@ jobs:
- go-os: darwin
go-arch: arm
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Chechout
uses: actions/checkout@v4
with:
Expand All @@ -85,7 +100,7 @@ jobs:
- name: Build
env:
RELEASE_VERSION: ${{ github.event_name == 'release' && github.event.release.tag_name || github.sha }}
RELEASE_VERSION: ${{ steps.meta.outputs.version }}
OS: ${{ matrix.go-os }}
GOOS: ${{ matrix.go-os }}
ARCH: ${{ matrix.go-arch }}
Expand All @@ -97,7 +112,7 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: s3sync-service-${{ github.event_name == 'release' && github.event.release.tag_name || github.sha }}-${{ matrix.go-os }}-${{ matrix.go-arch }}
name: s3sync-service-${{ steps.meta.outputs.version }}-${{ matrix.go-os }}-${{ matrix.go-arch }}
path: ./src/github.com/${{ github.repository }}/bin/s3sync-service-*

docker:
Expand Down Expand Up @@ -161,7 +176,7 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
build-args:
RELEASE_VERSION=${{ github.event_name == 'release' && github.event.release.tag_name || github.sha }}
RELEASE_VERSION=${{ steps.meta.outputs.version }}

publish:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 6d4791b

Please sign in to comment.