-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (45 loc) · 1.34 KB
/
octave.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
name: octave
on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'octave/**'
pull_request:
branches:
- master
paths:
- 'octave/**'
env:
IMAGE_NAME: octave
DOCKERHUB_REPO: ood-container
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
jobs:
test:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v2
- name: Test Build image
run: docker build . --file "octave/octave.Dockerfile" --tag $IMAGE_NAME
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v2
- name: Build image
run: docker build . --file "octave/octave.Dockerfile" --tag $IMAGE_NAME
- name: Log into registry
run: echo "$DOCKERHUB_TOKEN" | docker login -u $DOCKERHUB_USER --password-stdin
- name: Push image
run: |
IMAGE_ID=$DOCKERHUB_USER/$DOCKERHUB_REPO
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$IMAGE_NAME
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION