-
-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
87 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Publish Spectric Docker image | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Build"] | ||
types: [completed] | ||
branches: [spectric] | ||
|
||
env: | ||
DOCKER_REPOSITORY: ghcr.io/spectriclabs/pygeoapi | ||
DOCKER_TEST_IMAGE: ghcr.io/spectriclabs/pygeoapi:test | ||
|
||
jobs: | ||
on-success: | ||
name: Build, Test and Push Docker Image to DockerHub | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2.0.0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2.0.0 | ||
|
||
# - name: Log in to Docker Hub | ||
# uses: docker/login-action@v2.0.0 | ||
# with: | ||
# username: ${{ secrets.DOCKER_USERNAME }} | ||
# password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2.0.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and export to Docker | ||
uses: docker/build-push-action@v3.1.1 | ||
with: | ||
context: . | ||
load: true | ||
tags: ${{ env.DOCKER_TEST_IMAGE }} | ||
|
||
# - name: pygeoapi Unit Tests with Docker Image ⚙️ | ||
# run: | | ||
# docker run --entrypoint "/entrypoint.sh" --rm ${{ env.DOCKER_TEST_IMAGE }} test | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4.0.1 | ||
with: | ||
images: | | ||
${{ env.DOCKER_REPOSITORY }} | ||
ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v3.1.1 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
platforms: linux/arm64, linux/amd64 | ||
|
||
on-failure: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'failure' }} | ||
steps: | ||
- name: Print Test Fail | ||
run: echo Tests Failed |