-
Notifications
You must be signed in to change notification settings - Fork 74
48 lines (40 loc) · 1.39 KB
/
autobuild.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
name: Build Docker
on:
push:
branches-ignore:
- '*-prebuilt'
jobs:
build:
name: Build & Publish Docker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set DOCKER_REPO_NAME env
run: echo DOCKER_REPO_NAME=$(basename ${GITHUB_REPOSITORY}) >> ${GITHUB_ENV}
- name: Set IMAGE_TAG env
run: echo IMAGE_TAG=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}
- name: Environment Printer
uses: managedkaos/print-env@v1.0
- name: Append latest if master branches # env '${IMAGE_TAG},latest'
if: endsWith(github.ref, 'master')
run: echo IMAGE_TAG=${IMAGE_TAG},master,latest >> ${GITHUB_ENV}
- name: Environment Printer
uses: managedkaos/print-env@v1.0
- name: Build & Publish to Github Container Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: ${{ github.actor }}/${{ env.DOCKER_REPO_NAME }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
snapshot: false
tags: "${{ env.IMAGE_TAG }}"
- name: Build & Publish to DockerHub
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: ${{ github.repository }}
username: ${{ github.actor }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
snapshot: false
tags: "${{ env.IMAGE_TAG }}"