Skip to content

Improve devops documentation #100

Improve devops documentation

Improve devops documentation #100

on:
push:
branches: main
pull_request:
branches: main
name: Build and Push Docker Image
env:
# Use docker.io for Docker Hub if empty
REGISTRY: gcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
push_to_registry:
runs-on: ubuntu-latest
env:
R_KEEP_PKG_SOURCE: yes
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Decode Google API key file
env:
BASE64_STRING: ${{ secrets.GOOGLE_API_KEY_BASE64 }}
run: echo $BASE64_STRING > google_api_key.json
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
project_id: nunatsiavut-birds
credentials_json: ${{ secrets.GOOGLE_API_KEY_BASE64 }}
- name: Login to GAR
uses: docker/login-action@v3
with:
registry: northamerica-northeast1-docker.pkg.dev
username: _json_key
password: ${{ secrets.GOOGLE_API_KEY_BASE64 }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
build-args: |
MOVEBANK_USER=${{ secrets.MOVEBANK_USER }}
MOVEBANK_PW=${{ secrets.MOVEBANK_PW }}
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
tags: |
northamerica-northeast1-docker.pkg.dev/nunatsiavut-birds/insileco/nunatsiavut-bird-tracker:latest