-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (33 loc) · 1.11 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
name: Docker Build and Publish Image
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: sybila/pithya
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Prepare
id: prepare
run: |
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=release_tag::${{ github.event.release.tag_name }}
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker image
run: |
docker build \
--tag ${{ steps.prepare.outputs.docker_image }}:latest \
--tag ${{ steps.prepare.outputs.docker_image }}:${{ github.event.release.tag_name }} \
.
- name: Publish Docker image
# Only deploy if using master on original repo (and not for pull requests or forks)
if: github.repository_owner == 'sybila' && github.ref == 'refs/heads/master'
run: |
docker push --all-tags ${{ steps.prepare.outputs.docker_image }}