-
Notifications
You must be signed in to change notification settings - Fork 35
88 lines (75 loc) · 2.65 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# 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 Docker image
on:
workflow_run:
workflows: ["Build"]
types: [completed]
branches: [master]
env:
DOCKER_REPOSITORY: geopython/stetl
DOCKER_TEST_IMAGE: geopython/stetl:latest
jobs:
on-success:
name: Build, Test and Push Docker Image to DockerHub
runs-on: ubuntu-22.04
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.2.1
- name: Log in to Docker Hub
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Log in to the Container registry
# uses: docker/login-action@v2.1.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: stetl Unit Tests with Docker Image ⚙️
# run: |
# docker run --rm ${{ env.DOCKER_TEST_IMAGE }} nose2
# docker run -it --rm -it ${{ env.DOCKER_TEST_IMAGE }} sh -c "cd examples/basics && ./runall.sh"
- 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.3.0
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-22.04
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Print Test Fail
run: echo Tests Failed