Setup testing and image build #7
Workflow file for this run
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 fly exporter image | |
on: | |
pull_request: | |
paths: | |
- Dockerfile* | |
- .github/workflows/*.yaml | |
push: | |
branches: | |
- main | |
env: | |
QUAY_REPO: "quay.io/tigrisdata/fly-exporter" | |
jobs: | |
build-image: | |
name: Build and Push image | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Quay.io | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USER }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- name: Get short github SHA | |
id: var | |
shell: bash | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.QUAY_REPO }} | |
tags: | | |
github-${{ steps.var.outputs.sha_short }} | |
latest | |
- name: Build and push Docker images | |
id: build-push-to-quay | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} |