-
Notifications
You must be signed in to change notification settings - Fork 551
58 lines (50 loc) · 1.56 KB
/
image.yaml
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
name: docker
on:
push:
branches:
pull_request:
jobs:
docker:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set some variables
id: vars
run: |
short_sha=$(git rev-parse --short HEAD)
image="jupyter/nbviewer:$short_sha"
echo "image=$image" >> $GITHUB_OUTPUT
tags="$image"
if "${{ github.ref_name }}" == "main" ]]; then
tags="jupyter/nbviewer:latest $tags"
fi
echo "tags=$tags" >> $GITHUB_OUTPUT
- name: Check outputs
run: echo ${{ steps.vars.outputs.sha_short }}
- name: Login to docker hub
if: github.ref_name == 'main'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build
uses: docker/build-push-action@v2
with:
push: false
load: true
context: .
platforms: linux/amd64
tags: ${{ steps.vars.outputs.tags }}
- name: Test
run: |
docker run --rm -i ${{ steps.vars.outputs.image }} python3 -c "import nbviewer, pycurl, pylibmc"
docker run --rm -i ${{ steps.vars.outputs.image }} python3 -m nbviewer --help-all
- name: Push
if: github.ref_name == 'main'
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
push: ${{ github.ref_name == 'main' }}
tags: ${{ steps.vars.outputs.tags }}