Weekly Release #43
This file contains 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: Weekly Release | |
# Build a fresh image every week. | |
on: | |
schedule: | |
- cron: "0 14 * * 1" # run at 9am eastern US time every Monday | |
push: | |
branches: | |
- main | |
env: | |
LATEST_GO_VERSION: "1.22" | |
jobs: | |
build_and_upload_image: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: | |
- "1.21" | |
- "1.22" | |
steps: | |
- name: Set up Docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Build and Push Image | |
if: ${{ matrix.go-version != env.LATEST_GO_VERSION }} | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
GO_VERSION=${{ matrix.go-version }} | |
platforms: linux/amd64 # GitHub only offers AMD64 codespaces | |
pull: true | |
push: true | |
tags: ghcr.io/${{ github.repository }}:${{ matrix.go-version }} | |
cache-from: type=gha | |
# mode=max means "cache everything possible". This ensures maximum | |
# use of the cache, but will use up GitHub's 10 GB cache size limit | |
# faster. | |
cache-to: type=gha,mode=max | |
- name: Build and Push 'latest' Image | |
if: ${{ matrix.go-version == env.LATEST_GO_VERSION }} | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
GO_VERSION=${{ matrix.go-version }} | |
platforms: linux/amd64 # GitHub only offers AMD64 codespaces | |
pull: true | |
push: true | |
tags: ghcr.io/${{ github.repository }}:${{ matrix.go-version }},ghcr.io/${{ github.repository }}:latest | |
cache-from: type=gha | |
# mode=max means "cache everything possible". This ensures maximum | |
# use of the cache, but will use up GitHub's 10 GB cache size limit | |
# faster. | |
cache-to: type=gha,mode=max |