WIP #803
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: Docker | |
on: | |
push: | |
paths-ignore: | |
- 'docs/**' | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
# adapted from https://raw.githubusercontent.com/stefanprodan/podinfo/master/.github/workflows/release.yml | |
# | |
jobs: | |
containers: | |
name: ${{ matrix.container }} Container | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
container: ["proj","proj-docs"] | |
dockerfile: ["./Dockerfile", "./docs/docbuild/Dockerfile"] | |
exclude: | |
- container: "proj" | |
dockerfile: "./docs/docbuild/Dockerfile" | |
- container: "proj-docs" | |
dockerfile: "./Dockerfile" | |
env: | |
PUSH_PACKAGES: ${{ github.repository_owner == 'OSGeo' && github.event_name != 'pull_request' }} | |
CONTAINER: ${{ matrix.container }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Lint | |
id: lint | |
run: | | |
echo "are we pushing packages" ${{ env.PUSH_PACKAGES }} | |
echo "event_name" ${{ github.event_name }} | |
echo "ref" ${{ github.ref }} | |
- name: Setup Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: latest | |
- if: ${{ env.PUSH_PACKAGES == 'true' }} | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- if: ${{ env.PUSH_PACKAGES == 'true' }} | |
name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Prepare | |
id: prep | |
run: | | |
VERSION=sha-${GITHUB_SHA::8} | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF/refs\/tags\//} | |
fi | |
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT | |
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | |
- name: Build image | |
uses: docker/build-push-action@v4 | |
with: | |
push: ${{ env.PUSH_PACKAGES == 'true' }} | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
file: ${{ matrix.dockerfile }} | |
platforms: linux/amd64 | |
tags: | | |
docker.io/osgeo/${{ matrix.container }}:${{ steps.prep.outputs.VERSION }} | |
docker.io/osgeo/${{ matrix.container }}:latest | |
ghcr.io/osgeo/${{ matrix.container }}:${{ steps.prep.outputs.VERSION }} | |
ghcr.io/osgeo/${{ matrix.container }}:latest | |
labels: | | |
org.opencontainers.image.title=${{ github.event.repository.name }} | |
org.opencontainers.image.description=${{ github.event.repository.description }} | |
org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
org.opencontainers.image.url=${{ github.event.repository.html_url }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }} | |
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }} |