Initial commit #8
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: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
# TODO lint | |
# TODO tests | |
# Build and push image | |
build-image: | |
runs-on: ubuntu-latest | |
# TODO deps | |
# needs: | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Tag the image | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
bitovi/temporal-cloud-metrics-to-k8s | |
tags: | | |
type=raw,value=latest,enable=${{ github.ref_name == 'main' }} | |
type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: github.event_name != 'pull_request' | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- | |
name: Build Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
- | |
name: Push Docker image | |
uses: docker/build-push-action@v4 | |
if: ${{ (github.ref_name == 'main') || (github.event_name == 'release') }} | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
push: true |