diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index 01abfd84..b3adb7ef 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -11,11 +11,36 @@ on: - cron: '41 5 * * *' workflow_dispatch: inputs: - latest_branch: + branch: description: "Branch from which to create the latest Docker image (default: latest_candidate)" type: string required: true - default_value: latest_candidate + default: latest_candidate + disable_tests: + description: "Should the tests be skipped?" + type: boolean + required: True + default: False + platforms: + description: "Platforms to build" + type: choice + required: True + options: + - linux/amd64 + - linux/arm64/v8 + - linux/amd64,linux/arm64/v8 + default: linux/amd64,linux/arm64/v8 + tag: + description: "Tag for the resulting images" + type: string + required: True + default: 'experimental' + +env: + BRANCH: ${{ inputs.branch || 'latest_candidate' }} + PLATFORMS: ${{ inputs.platforms || 'linux/amd64,linux/arm64/v8' }} + TAG: ${{ inputs.tag || 'experimental' }} + DOCKER_HUB_OWNER: ${{ vars.DOCKER_HUB_OWNER || github.repository_owner }} jobs: push_to_registry: @@ -32,21 +57,23 @@ jobs: repo: "grist-core" - name: "grist" repo: "grist-ee" - # For now, we build it twice, with `grist-ee` being a - # backwards-compatible synonym for `grist`. - - name: "grist-ee" - repo: "grist-ee" steps: + - name: Build settings + run: | + echo "Branch: $BRANCH" + echo "Platforms: $PLATFORMS" + echo "Docker Hub Owner: $DOCKER_HUB_OWNER" + echo "Tag: $TAG" + - name: Check out the repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: - ref: ${{ inputs.latest_branch }} + ref: ${{ env.BRANCH }} - name: Check out the ext/ directory if: matrix.image.name != 'grist-oss' run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }} - - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -58,38 +85,44 @@ jobs: with: context: . load: true - tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental + tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }} cache-from: type=gha build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }} - name: Use Node.js ${{ matrix.node-version }} for testing + if: ${{ !inputs.disable_tests }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - name: Set up Python ${{ matrix.python-version }} for testing - maybe not needed + if: ${{ !inputs.disable_tests }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install Python packages + if: ${{ !inputs.disable_tests }} run: | pip install virtualenv yarn run install:python - name: Install Node.js packages + if: ${{ !inputs.disable_tests }} run: yarn install - name: Build Node.js code + if: ${{ !inputs.disable_tests }} run: | rm -rf ext yarn run build:prod - name: Run tests - run: TEST_IMAGE=${{ github.repository_owner }}/${{ matrix.image.name }}:experimental VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker + if: ${{ !inputs.disable_tests }} + run: TEST_IMAGE=${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }} VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker - name: Restore the ext/ directory - if: matrix.image.name != 'grist-oss' + if: ${{ matrix.image.name != 'grist-oss' && !inputs.disable_tests }} run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }} - name: Log in to Docker Hub @@ -102,13 +135,28 @@ jobs: uses: docker/build-push-action@v2 with: context: . - platforms: linux/amd64,linux/arm64/v8 + platforms: ${{ env.PLATFORMS }} push: true - tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental + tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }} cache-from: type=gha cache-to: type=gha,mode=max build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }} + - 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 + update_latest_branch: name: Update latest branch runs-on: ubuntu-latest diff --git a/buildtools/.grist-ee-version b/buildtools/.grist-ee-version index 2003b639..a602fc9e 100644 --- a/buildtools/.grist-ee-version +++ b/buildtools/.grist-ee-version @@ -1 +1 @@ -0.9.2 +0.9.4