2021-04-12 19:25:34 +00:00
|
|
|
name: Push Docker image
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
|
|
workflow_dispatch:
|
2024-07-11 21:25:32 +00:00
|
|
|
inputs:
|
|
|
|
tag:
|
|
|
|
description: "Tag for the resulting images"
|
|
|
|
type: string
|
|
|
|
required: True
|
|
|
|
default: 'stable'
|
|
|
|
|
|
|
|
env:
|
|
|
|
TAG: ${{ inputs.tag || 'stable' }}
|
|
|
|
DOCKER_HUB_OWNER: ${{ vars.DOCKER_HUB_OWNER || github.repository_owner }}
|
2021-04-12 19:25:34 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
push_to_registry:
|
2024-06-21 21:55:30 +00:00
|
|
|
name: Push Docker images to Docker Hub
|
2021-04-12 19:25:34 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-06-21 21:55:30 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
image:
|
2024-06-21 21:56:07 +00:00
|
|
|
# We build two images, `grist-oss` and `grist`.
|
|
|
|
# See https://github.com/gristlabs/grist-core?tab=readme-ov-file#available-docker-images
|
2024-06-21 21:55:30 +00:00
|
|
|
- name: "grist-oss"
|
|
|
|
repo: "grist-core"
|
|
|
|
- name: "grist"
|
|
|
|
repo: "grist-ee"
|
2021-04-12 19:25:34 +00:00
|
|
|
steps:
|
|
|
|
- name: Check out the repo
|
2024-06-21 21:55:30 +00:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2024-07-11 21:28:29 +00:00
|
|
|
- name: Add a dummy ext/ directory
|
|
|
|
run:
|
|
|
|
mkdir ext && touch ext/dummy
|
|
|
|
|
2024-06-21 21:55:30 +00:00
|
|
|
- name: Check out the ext/ directory
|
|
|
|
if: matrix.image.name != 'grist-oss'
|
|
|
|
run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }}
|
|
|
|
|
2022-04-03 23:43:29 +00:00
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
2023-07-12 21:31:00 +00:00
|
|
|
uses: docker/metadata-action@v4
|
2022-04-03 23:43:29 +00:00
|
|
|
with:
|
|
|
|
images: |
|
2024-06-21 21:55:30 +00:00
|
|
|
${{ github.repository_owner }}/${{ matrix.image.name }}
|
2022-04-03 23:43:29 +00:00
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
2023-07-12 21:31:00 +00:00
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
2024-07-11 21:25:32 +00:00
|
|
|
${{ env.TAG }}
|
2022-04-03 23:43:29 +00:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
2024-06-21 21:55:30 +00:00
|
|
|
|
2022-04-03 23:43:29 +00:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
2024-06-21 21:55:30 +00:00
|
|
|
|
2022-04-03 23:43:29 +00:00
|
|
|
- name: Log in to Docker Hub
|
2024-06-21 21:55:30 +00:00
|
|
|
uses: docker/login-action@v3
|
2021-04-12 19:25:34 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
2024-06-21 21:55:30 +00:00
|
|
|
|
2022-04-03 23:43:29 +00:00
|
|
|
- name: Push to Docker Hub
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2022-04-07 01:41:03 +00:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
2024-07-11 21:28:29 +00:00
|
|
|
build-contexts: ext=ext
|
2024-06-21 21:55:30 +00:00
|
|
|
|
2024-07-11 21:27:13 +00:00
|
|
|
- name: Push Enterprise to Docker Hub
|
|
|
|
if: ${{ matrix.image.name == 'grist' }}
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
build-args: |
|
|
|
|
BASE_IMAGE=${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name}}
|
|
|
|
BASE_VERSION=${{ env.TAG }}
|
|
|
|
file: ext/Dockerfile
|
|
|
|
platforms: ${{ env.PLATFORMS }}
|
|
|
|
push: true
|
|
|
|
tags: ${{ env.DOCKER_HUB_OWNER }}/grist-ee:${{ env.TAG }}
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|