56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
name: Build base image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'Dockerfile.base'
|
|
- '.forgejo/workflows/build-base.yaml'
|
|
schedule:
|
|
- cron: '0 6 * * 0'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: git.mcintire.me
|
|
IMAGE_NAME: graham/prop-base
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-and-push:
|
|
name: Build and push base image
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://github.com/actions/checkout@v4
|
|
|
|
- name: Generate image tag
|
|
id: tag
|
|
run: |
|
|
WGRIB2=$(grep -E '^ARG WGRIB2_VERSION=' Dockerfile.base | head -1 | cut -d= -f2)
|
|
G2C=$(grep -E '^ARG G2C_VERSION=' Dockerfile.base | head -1 | cut -d= -f2)
|
|
TIMESTAMP=$(date +%s)
|
|
TAG="wgrib2-${WGRIB2}-g2c-${G2C}-${TIMESTAMP}"
|
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build and push base image via Kaniko
|
|
uses: graham/infra/.forgejo/actions/kaniko-build@main
|
|
with:
|
|
dockerfile: Dockerfile.base
|
|
token: ${{ secrets.FORGEJO_TOKEN }}
|
|
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tag: ${{ steps.tag.outputs.tag }}
|
|
extra_args: "--build-arg CACHE_BUST=$(date -u +%G-W%V)"
|
|
|
|
- name: Tag as latest
|
|
uses: graham/infra/.forgejo/actions/kaniko-build@main
|
|
with:
|
|
dockerfile: Dockerfile.base
|
|
token: ${{ secrets.FORGEJO_TOKEN }}
|
|
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tag: latest
|
|
extra_args: ""
|