corso/.github/workflows/image.yml
Keepers b739526bb5
use dorny version of skipping workflow jobs (#768)
## Description

The current action workflow skips cause requried
actions to be marked as passing until they fail,
not marked as incomplete until either passed,
failed, or skipped.  This change should provide
the latter behavior.


## Type of change

- [x] 🌻 Feature

## Issue(s)

* #744

## Test Plan

- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
2022-09-14 22:23:17 +00:00

76 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@issue-744-alt
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:
- 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 }}
- 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 }}