Skip to content

Allow geo.txt files to be uploaded to new task #136

Allow geo.txt files to be uploaded to new task

Allow geo.txt files to be uploaded to new task #136

name: Build and Publish Database Image
on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [published]
jobs:
check_files:
name: Test changed-files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Get changed files in the db folder
id: changed-files-specific
uses: tj-actions/changed-files@v32
with:
files: |
db/**
- name: Run step if any file(s) in the db folder change
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
echo "One or more files in the db folder has changed."
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
outputs:
db_changed: ${{ steps.changed-files-specific.outputs.any_changed }}
build:
name: Build and push database docker image to GitHub Packages
runs-on: ubuntu-latest
needs: [ check_files ]
if: needs.check_files.outputs.db_changed == 'True'
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/auscalabledronecloud/asdc-webodm-db
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
${{ env.SHORT_SHA }}-${{ github.run_number }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to GitHub Packages
uses: docker/build-push-action@v4
with:
context: ./db/
push: true
no-cache: true
tags: |
ghcr.io/auscalabledronecloud/asdc-webodm-db:latest
${{ steps.meta.outputs.tags }}