-
Notifications
You must be signed in to change notification settings - Fork 17
68 lines (62 loc) · 2.64 KB
/
build.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
57
58
59
60
61
62
63
64
65
66
67
68
name: Build and publish
on:
push:
branches:
- '**'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'master'
release:
types: [ created ]
schedule:
- cron: "0 1 * * 6" # Run at 1am every Saturday
jobs:
build_and_publish:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Declare GIT variables
id: vars
shell: bash
run: |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/} | awk '{print tolower($0)}')"
echo "##[set-output name=repository;]$(echo ${{ github.event.repository.name }} | awk '{print tolower($0)}')"
echo "##[set-output name=registry_repository;]$(echo ${{ github.event.repository.name }} |sed -e 's/\([A-Z]\)/-\L\1/g' -e 's/^-//')"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
-
name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ secrets.DOCKER_REPOSITORY_HOSTNAME }}/${{ steps.vars.outputs.registry_repository }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Docker Login
uses: docker/login-action@v1.10.0
if: github.event_name != 'pull_request'
with:
registry: registry.mollie.shop
username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }}
password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }}
logout: true
- name: Build and push php
uses: docker/build-push-action@v2
if: github.event_name != 'pull_request'
with:
context: .
target: result_php
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}