corso/.github/workflows/image.yml
Keepers 9357d6b6ac
swap over the remaining go setup scripts (#957)
## Type of change

- [x] 💻 CI/Deployment

## Issue(s)

* #790

## Test Plan

- [x] 💚 E2E
2022-09-27 17:12:14 +00:00

75 lines
2.0 KiB
YAML

name: Publish Docker Container Images
on:
push:
branches: [main]
permissions:
contents: read
packages: write
pull-requests: read
jobs:
precheck:
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@main
Per-SHA-Image:
needs: precheck
if: needs.precheck.outputs.fileschanged == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: build
env:
PLATFORMS: linux/amd64,linux/arm64
steps:
- 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 }}
- id: hash
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
# deploy the image
- name: Build image and push to GitHub Container Registry
env:
imageName: ghcr.io/alcionai/corso
uses: docker/build-push-action@v3
with:
context: .
file: ./build/Dockerfile
platforms: ${{ env.PLATFORMS }}
push: true
tags: ${{ env.imageName }}:latest,${{ env.imageName }}:${{ steps.hash.outputs.sha_short }}
# 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 }}