corso/.github/workflows/image.yml
Keepers a9e66b0db4
Issue 570 deploy sep b (#719)
Recovery action after losing this commit upon merging `issue-570-deploy`.
2022-09-01 16:40:36 +00:00

67 lines
1.7 KiB
YAML

name: Publish Docker Container Images
on:
push:
branches: [main]
permissions:
contents: read
packages: write
jobs:
Per-SHA-Image:
runs-on: ubuntu-latest
defaults:
run:
working-directory: build
env:
PLATFORMS: linux/amd64,linux/arm64
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build Corso Binaries
run: >
./build.sh
--platforms ${{ env.PLATFORMS }}
# - name: Build Corso Binaries Locally
# run: >
# ./multiplatform-binary.sh
# --platforms ${{ env.PLATFORMS }}
# apparently everyone uses this step
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# setup Docker buld action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# retrieve credentials for ghcr.io
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# deploy the image
- name: Build image and push to GitHub Container Registry
env:
sha: git_hash=$(git rev-parse --short "$GITHUB_SHA")
uses: docker/build-push-action@v3
with:
context: .
file: ./build/Dockerfile
platforms: ${{ env.PLATFORMS }}
push: true
tags: ghcr.io/alcionai/corso:${{ env.sha }}
# use the github cache
cache-from: type=gha
cache-to: type=gha,mode=max
# check the image digest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}