Merge pull request #1300 from GeoscienceAustralia/extra_urban_config_… #745
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: Docker Image CI | |
on: | |
push: | |
branches: [ master ] | |
path: | |
- 'dev/services/wms/**' | |
- 'prod/services/wms/**' | |
release: | |
types: [created, edited, published] | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
env: | |
IMAGE_NAME: geoscienceaustralia/dea-datakube-config | |
jobs: | |
publish_config_image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: python -m pip install pylint datacube-ows | |
- name: Run linting and tests | |
run: ./check-code.sh | |
# If action is triggered by a release, push image to | |
# AWS ECR using custom image tag extracted from the release | |
- name: Get current version tag from release to use as image tag | |
if: github.event_name == 'release' | |
run: | | |
echo "RELEASE=${GITHUB_REF/refs\/tags\/}" >> $GITHUB_ENV | |
# If action is trigged by a push (not release), push a | |
# latest/unstable image to AWS ECR using image tag based | |
# on the most recent Github tag and commit hash | |
- name: Get git commit hash for push to branch to use as image tag | |
if: github.event_name != 'release' | |
run: | | |
git fetch --prune --unshallow 2> /dev/null || true | |
echo "RELEASE=$(git describe --tags)" >> $GITHUB_ENV | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::538673716275:role/github-actions-role | |
aws-region: ap-southeast-2 | |
- name: Push image to ECR | |
uses: whoan/docker-build-with-cache-action@master | |
with: | |
context: ./ | |
registry: 538673716275.dkr.ecr.ap-southeast-2.amazonaws.com | |
image_name: ${{ env.IMAGE_NAME }} | |
image_tag: latest,${{ env.RELEASE }} |