Merge pull request #17 from lsst-epo/master #95
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Build and push container image' | |
on: | |
push: | |
branches: | |
- '*' | |
jobs: | |
build-and-push: | |
name: 'Build and push container image' | |
runs-on: ubuntu-latest | |
# Checkout the repository to the GitHub Actions runner | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
# gcloud CLI setup | |
- name: Login to GCP | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.DEV_SA_KEY }} | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
# Configure Docker to use the gcloud command-line tool as a credential helper for authentication | |
- run: gcloud --quiet auth configure-docker us-central1-docker.pkg.dev | |
- name: Docker meta | |
id: meta # you'll use this in the next step | |
uses: docker/metadata-action@v3 | |
with: | |
images: | | |
us-central1-docker.pkg.dev/skyviewer/public-images/craft-base-image | |
flavor: | | |
latest=${{ github.ref == 'master'}} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |