Skip to content

Merge pull request #148 from Mosquito-Alert/add_gbif_id #15

Merge pull request #148 from Mosquito-Alert/add_gbif_id

Merge pull request #148 from Mosquito-Alert/add_gbif_id #15

Workflow file for this run

name: Create and publish a Docker image
on:
workflow_dispatch:
push:
branches:
- main
- master
- alpha
- beta
- v2
tags:
- 'v*'
# Defines two custom environment variables for the workflow.
# These are used for the Container registry domain, and a
# name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
name: Test and lint
uses: ./.github/workflows/ci.yml
build-and-push-image:
needs: test
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# set dev-latest tag for v2 branch
type=raw,value=dev-latest,enable=${{ github.ref == format('refs/heads/{0}', 'v2') }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
# Same as Makefile
build-args: |
BUILD_ENVIRONMENT=production
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max