Publish Docker DB image #7
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: Publish Docker DB image | |
on: workflow_dispatch | |
jobs: | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
root-reserve-mb: 32000 | |
swap-size-mb: 1024 | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
with: | |
sparse-checkout-cone-mode: false | |
sparse-checkout: | | |
/* | |
!results | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Check upstream version | |
id: version | |
run: | | |
GNAF_LOADER_TAG=$(curl -s https://api.github.com/repos/minus34/gnaf-loader/releases/latest | jq -r .tag_name) | |
echo "GNAF_LOADER_TAG=$GNAF_LOADER_TAG" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: lukeprior/nbn-upgrade-map-db | |
tags: | | |
type=raw,value=${{ steps.version.outputs.GNAF_LOADER_TAG }} | |
# set latest tag for main branch | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
- name: Download GNAF data dmp | |
run: | | |
GNAF_LOADER_TAG=${{ steps.version.outputs.GNAF_LOADER_TAG }} | |
curl --insecure https://minus34.com/opendata/geoscape-$GNAF_LOADER_TAG/gnaf-$GNAF_LOADER_TAG.dmp --output ./extra/db/gnaf-$GNAF_LOADER_TAG.dmp | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./extra/db | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
GNAF_LOADER_TAG=${{ steps.version.outputs.GNAF_LOADER_TAG }} | |
- name: Convert the Postgres DB to SQLite | |
run: ./extra/db/docker2sqlite.sh | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: sqlite-db-${{ steps.version.outputs.GNAF_LOADER_TAG }} | |
body: SQLite DB for the cutdown version of the GNAF address database | |
files: address_principals.sqlite |