2021-11-24 18:45:21 +00:00
|
|
|
name: Push latest Docker image
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
# Trigger if latest_candidate updates. This is automatically done by another
|
|
|
|
# workflow whenever tests pass on main - but events don't chain without using
|
|
|
|
# personal access tokens so we just use a cron job.
|
|
|
|
branches: [ latest_candidate ]
|
|
|
|
schedule:
|
|
|
|
# Run at 5:41 UTC daily
|
|
|
|
- cron: '41 5 * * *'
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
push_to_registry:
|
|
|
|
name: Push latest Docker image to Docker Hub
|
|
|
|
runs-on: ubuntu-latest
|
2021-12-13 18:35:00 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
python-version: [2.7]
|
2022-03-28 19:43:47 +00:00
|
|
|
node-version: [14.x]
|
2021-11-24 18:45:21 +00:00
|
|
|
steps:
|
|
|
|
- name: Check out the repo
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: latest_candidate
|
2022-04-03 23:43:29 +00:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
2021-12-13 18:35:00 +00:00
|
|
|
- name: Prepare image but do not push it yet
|
2022-04-03 23:43:29 +00:00
|
|
|
uses: docker/build-push-action@v2
|
2021-12-13 18:35:00 +00:00
|
|
|
with:
|
2022-04-03 23:43:29 +00:00
|
|
|
context: .
|
|
|
|
load: true
|
|
|
|
tags: ${{ github.repository_owner }}/grist:latest
|
2022-04-07 01:41:03 +00:00
|
|
|
cache-from: type=gha
|
2021-12-13 18:35:00 +00:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }} for testing
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
- name: Set up Python ${{ matrix.python-version }} for testing - maybe not needed
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install Python packages
|
|
|
|
run: |
|
|
|
|
pip install virtualenv
|
|
|
|
yarn run install:python
|
|
|
|
- name: Install Node.js packages
|
|
|
|
run: yarn install
|
|
|
|
- name: Build Node.js code
|
|
|
|
run: yarn run build:prod
|
|
|
|
- name: Run tests
|
|
|
|
run: TEST_IMAGE=${{ github.repository_owner }}/grist VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker
|
2022-04-03 23:43:29 +00:00
|
|
|
- name: Log in to Docker Hub
|
|
|
|
uses: docker/login-action@v1
|
2021-11-24 18:45:21 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
2022-04-03 23:43:29 +00:00
|
|
|
- name: Push to Docker Hub
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
|
|
push: true
|
|
|
|
tags: ${{ github.repository_owner }}/grist:latest
|
2022-04-07 01:41:03 +00:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
2021-11-24 18:45:21 +00:00
|
|
|
- name: Update latest branch
|
|
|
|
uses: ad-m/github-push-action@8407731efefc0d8f72af254c74276b7a90be36e1
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
branch: latest
|
|
|
|
force: true
|