corso/.github/workflows/image.yml
Keepers 1f8c3cdb11
only run actions on /src changes (#750)
## Description

Re-opening the PR with a hack (sourced from github
themselves) to skip the required check if we don't run
the standard required jobs.

## Type of change

- [x] 🌻 Feature

## Issue(s)

#744

## Test Plan

- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
2022-09-02 22:30:18 +00:00

71 lines
1.7 KiB
YAML

name: Publish Docker Container Images
on:
push:
branches: [main]
paths:
- '/src/**'
- '/.github/**'
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 }}