Skip to content

Disable type checking for testing #210

Disable type checking for testing

Disable type checking for testing #210

name: Build and publish Docker Image into GitHub Container Registry
on:
push:
tags:
- 'cr*'
branches:
- 'master'
- 'dev'
jobs:
setup:
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-key.outputs.key }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
driver-opts: |
network=host
buildkitd-flags: --debug
- name: Generate cache key
id: cache-key
run: echo "key=${{ runner.os }}-buildx-${{ hashFiles('**/yarn.lock') }}" >> $GITHUB_OUTPUT
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ steps.cache-key.outputs.key }}
restore-keys: |
${{ runner.os }}-buildx-
build:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
- name: Restore cache
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ needs.setup.outputs.cache-key }}
- name: Build image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: |
${{ github.ref == 'refs/heads/master' && format('ghcr.io/{0}:master', github.repository) || '' }}
${{ github.ref == 'refs/heads/dev' && format('ghcr.io/{0}:dev', github.repository) || '' }}
outputs: type=docker,dest=/tmp/myimage.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: docker-image
path: /tmp/myimage.tar
push:
needs: [setup, build]
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Download image artifact
uses: actions/download-artifact@v3
with:
name: docker-image
path: /tmp
- name: Load Docker image
run: docker load --input /tmp/myimage.tar
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Push image
run: |
if [[ $GITHUB_REF == refs/heads/master ]]; then
docker push ghcr.io/${{ github.repository }}:master
elif [[ $GITHUB_REF == refs/heads/dev ]]; then
docker push ghcr.io/${{ github.repository }}:dev
fi