Add build stage to Dockerfile #212
Workflow file for this run
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 : Index Test and Push | |
env: | |
IMAGE_NAME: opendatacube/datacube-index | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'index/**' | |
- '.github/workflows/index-*' | |
push: | |
branches: | |
- main | |
paths: | |
- 'index/**' | |
- '.github/workflows/index-*' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run Dockerized Bootstrapping from Git | |
timeout-minutes: 20 | |
shell: bash | |
run: | | |
cd index | |
make test-bootstrapping | |
- name: Run Dockerized Tests for S3 | |
timeout-minutes: 20 | |
shell: bash | |
run: | | |
cd index | |
make test-indexing | |
push: | |
if: github.ref == 'refs/heads/main' | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Verify Changed files | |
uses: tj-actions/changed-files@v45 | |
id: verify-changed-version | |
with: | |
files: | | |
index/version.txt | |
- name: Run step only when version.txt change. | |
if: steps.verify-changed-version.outputs.any_changed == 'true' | |
run: | | |
echo "VERSION=$(cat index/version.txt)" >> $GITHUB_ENV | |
- name: echo dev version for dockhub image tagging | |
if: steps.verify-changed-version.outputs.any_changed == 'false' | |
run: | | |
echo "VERSION=$(cat index/version.txt).dev${{ github.run_id }}" >> $GITHUB_ENV | |
- name: Build and Push unstable Docker Image from PR / Push to Master | |
uses: whoan/docker-build-with-cache-action@v8 | |
with: | |
context: index | |
image_name: ${{ env.IMAGE_NAME }} | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASS }} | |
image_tag: latest,${{ env.VERSION }} | |
- name: Update Docker Hub Description | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASS }} | |
repository: ${{ env.IMAGE_NAME }} | |
readme-filepath: ./index/readme.md | |
short-description: Open Data Cube Indexing Image |