-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (38 loc) · 1.56 KB
/
main.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
# This is a basic workflow to help you get started with Actions
name: Build and push to Docker Hub
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: ['*']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to Docker Hub
# Uses v1.10.0, sha1 is used for better security
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get docker tag for master
if: github.ref == 'refs/heads/master'
shell: bash
run: echo "DOCKER_TAG=latest" >> $GITHUB_ENV
- name: Get branch for all other branches
if: github.ref != 'refs/heads/master'
shell: bash
run: echo "DOCKER_TAG=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Build and push Docker image
# Uses v2.7.0, sha1 is used for better security
uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229
with:
context: .
push: true
tags: intera/ci-php-ant:${{ env.DOCKER_TAG }},intera/docker-ci-php-ant:${{ env.DOCKER_TAG }}