Skip to content

Commit 28d7ab6

Browse files
authored
Merge pull request #190 from devilbox/release-0.122
Release 0.122
2 parents f0c625d + 395e4d3 commit 28d7ab6

22 files changed

+616
-409
lines changed

.github/FUNDING.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: [cytopia]
2+
patreon: devilbox

.github/workflows/php-ci.yml renamed to .github/workflows/build.yml

+52-74
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# -------------------------------------------------------------------------------------------------
44
# Job Name
55
# -------------------------------------------------------------------------------------------------
6-
name: PHP-CI
6+
name: build
77

88

99
# -------------------------------------------------------------------------------------------------
@@ -12,55 +12,14 @@ name: PHP-CI
1212
on:
1313
# Runs on Pull Requests
1414
pull_request:
15-
16-
# Runs on master Branch and Tags
15+
# Runs on Push
1716
push:
18-
branches:
19-
- master
20-
tags:
21-
- '[0-9]+.[0-9]+*'
2217

2318

2419
# -------------------------------------------------------------------------------------------------
2520
# What to run
2621
# -------------------------------------------------------------------------------------------------
2722
jobs:
28-
diagnostics:
29-
name: Diagnostics
30-
runs-on: ubuntu-latest
31-
strategy:
32-
fail-fast: False
33-
steps:
34-
- name: Checkout repository
35-
uses: actions/checkout@v2
36-
37-
- name: Show environment
38-
run: |
39-
env
40-
41-
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context
42-
- name: Show GitHub variables
43-
run: |
44-
echo "github.actor: ${{ github.actor }}"
45-
echo "github.ref: ${{ github.ref }}"
46-
echo "github.base_ref: ${{ github.base_ref }}"
47-
echo "github.head_ref: ${{ github.head_ref }}"
48-
echo "github.event: ${{ github.event }}"
49-
echo "github.event_name: ${{ github.event_name }}"
50-
echo "github.event.pull_request.base.repo.id: ${{ github.event.pull_request.base.repo.id }}"
51-
echo "github.event.pull_request.head.repo.id: ${{ github.event.pull_request.head.repo.id }}"
52-
53-
- name: Dump GitHub context
54-
env:
55-
GITHUB_CONTEXT: ${{ toJson(github) }}
56-
run: echo "${GITHUB_CONTEXT}"
57-
58-
- name: Dump Runner context
59-
env:
60-
RUNNER_CONTEXT: ${{ toJson(runner) }}
61-
run: echo "${RUNNER_CONTEXT}"
62-
63-
6423
build:
6524
name: "[ PHP-${{ matrix.version }} ]"
6625
runs-on: ubuntu-latest
@@ -83,7 +42,7 @@ jobs:
8342
steps:
8443

8544
# ------------------------------------------------------------
86-
# Checkout repository
45+
# Setup repository
8746
# ------------------------------------------------------------
8847
- name: Checkout repository
8948
uses: actions/checkout@v2
@@ -97,7 +56,7 @@ jobs:
9756
# Retrieve git info (tags, etc)
9857
git fetch --all
9958
100-
# BRANCH, TAG or COMMIT
59+
# Branch, Tag or Commit
10160
GIT_TYPE="$( \
10261
curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \
10362
| sh \
@@ -111,15 +70,37 @@ jobs:
11170
| grep '^GIT_NAME' \
11271
| sed 's|.*=||g' \
11372
)"
73+
# Docker Tag
74+
if [ "${GIT_TYPE}" = "BRANCH" ] && [ "${GIT_SLUG}" = "master" ]; then
75+
DOCKER_TAG_BASE="${VERSION}-base"
76+
DOCKER_TAG_MODS="${VERSION}-mods"
77+
DOCKER_TAG_PROD="${VERSION}-prod"
78+
DOCKER_TAG_WORK="${VERSION}-work"
79+
else
80+
DOCKER_TAG_BASE="${VERSION}-base-${GIT_SLUG}"
81+
DOCKER_TAG_MODS="${VERSION}-mods-${GIT_SLUG}"
82+
DOCKER_TAG_PROD="${VERSION}-prod-${GIT_SLUG}"
83+
DOCKER_TAG_WORK="${VERSION}-work-${GIT_SLUG}"
84+
fi
11485
11586
# Output
11687
echo "GIT_TYPE=${GIT_TYPE}"
11788
echo "GIT_SLUG=${GIT_SLUG}"
89+
echo "DOCKER_TAG_BASE=${DOCKER_TAG_BASE}"
90+
echo "DOCKER_TAG_MODS=${DOCKER_TAG_MODS}"
91+
echo "DOCKER_TAG_PROD=${DOCKER_TAG_PROD}"
92+
echo "DOCKER_TAG_WORK=${DOCKER_TAG_WORK}"
11893
11994
# Export variable
12095
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files
121-
echo "GIT_TYPE=${GIT_TYPE}" >> $GITHUB_ENV
122-
echo "GIT_SLUG=${GIT_SLUG}" >> $GITHUB_ENV
96+
echo "GIT_TYPE=${GIT_TYPE}" >> ${GITHUB_ENV}
97+
echo "GIT_SLUG=${GIT_SLUG}" >> ${GITHUB_ENV}
98+
echo "DOCKER_TAG_BASE=${DOCKER_TAG_BASE}" >> ${GITHUB_ENV}
99+
echo "DOCKER_TAG_MODS=${DOCKER_TAG_MODS}" >> ${GITHUB_ENV}
100+
echo "DOCKER_TAG_PROD=${DOCKER_TAG_PROD}" >> ${GITHUB_ENV}
101+
echo "DOCKER_TAG_WORK=${DOCKER_TAG_WORK}" >> ${GITHUB_ENV}
102+
env:
103+
VERSION: ${{ matrix.version }}
123104

124105

125106
# ------------------------------------------------------------
@@ -139,6 +120,7 @@ jobs:
139120
done;
140121
return 1;
141122
}
123+
retry make _pull-base-image VERSION=${VERSION}
142124
retry make build-base VERSION=${VERSION}
143125
env:
144126
VERSION: ${{ matrix.version }}
@@ -310,9 +292,8 @@ jobs:
310292

311293

312294
# ------------------------------------------------------------
313-
# Push build artifacts
295+
# Deploy
314296
# ------------------------------------------------------------
315-
# Only run this, if the PR was created by the repo owner
316297
- name: Publish images (only repo owner)
317298
run: |
318299
retry() {
@@ -328,42 +309,39 @@ jobs:
328309
return 1;
329310
}
330311
331-
# Info output
332-
echo "Git Type: ${GIT_TYPE}"
333-
echo "Git Slug: ${GIT_SLUG}"
312+
# Output
313+
echo "GIT_TYPE=${GIT_TYPE}"
314+
echo "GIT_SLUG=${GIT_SLUG}"
315+
echo "DOCKER_TAG_BASE=${DOCKER_TAG_BASE}"
316+
echo "DOCKER_TAG_MODS=${DOCKER_TAG_MODS}"
317+
echo "DOCKER_TAG_PROD=${DOCKER_TAG_PROD}"
318+
echo "DOCKER_TAG_WORK=${DOCKER_TAG_WORK}"
319+
320+
# Tag image
321+
retry make tag OLD_TAG="${VERSION}-base" NEW_TAG="${DOCKER_TAG_BASE}"
322+
retry make tag OLD_TAG="${VERSION}-mods" NEW_TAG="${DOCKER_TAG_MODS}"
323+
retry make tag OLD_TAG="${VERSION}-prod" NEW_TAG="${DOCKER_TAG_PROD}"
324+
retry make tag OLD_TAG="${VERSION}-work" NEW_TAG="${DOCKER_TAG_WORK}"
325+
docker images
334326
335327
# Login
336-
echo "retry make login USER= PASS="
328+
retry make login USERNAME=${{ secrets.DOCKERHUB_USERNAME }} PASSWORD=${{ secrets.DOCKERHUB_PASSWORD }}
337329
338330
# Push
339-
if [ "${GIT_TYPE}" = "TAG" ]; then
340-
echo "retry make push-base VERSION=${VERSION}-${GIT_SLUG}"
341-
echo "retry make push-mods VERSION=${VERSION}-${GIT_SLUG}"
342-
echo "retry make push-prod VERSION=${VERSION}-${GIT_SLUG}"
343-
echo "retry make push-work VERSION=${VERSION}-${GIT_SLUG}"
344-
else
345-
if [ "${GIT_SLUG}" = "master" ]; then
346-
echo "retry make push-base VERSION=${VERSION}"
347-
echo "retry make push-mods VERSION=${VERSION}"
348-
echo "retry make push-prod VERSION=${VERSION}"
349-
echo "retry make push-work VERSION=${VERSION}"
350-
else
351-
echo "retry make push-base VERSION=${VERSION}-${GIT_SLUG}"
352-
echo "retry make push-mods VERSION=${VERSION}-${GIT_SLUG}"
353-
echo "retry make push-prod VERSION=${VERSION}-${GIT_SLUG}"
354-
echo "retry make push-work VERSION=${VERSION}-${GIT_SLUG}"
355-
fi
356-
fi
331+
retry make push TAG=${DOCKER_TAG_BASE}
332+
retry make push TAG=${DOCKER_TAG_MODS}
333+
retry make push TAG=${DOCKER_TAG_PROD}
334+
retry make push TAG=${DOCKER_TAG_WORK}
357335
env:
358336
VERSION: ${{ matrix.version }}
359337
RETRIES: 20
360338
PAUSE: 10
361339
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions
362340
if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
363341
&& (
364-
(github.event_name == 'schedule' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
342+
(github.event_name == 'schedule' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
365343
||
366-
(github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
344+
(github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
367345
||
368-
(github.event_name == 'pull_request' && (startsWith(github.head_ref, 'release-')))
346+
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-'))
369347
)

.github/workflows/linting.yml

+40-12
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,55 @@
11
---
22

3-
###
4-
### Lints all generic and json files in the whole git repository
5-
###
3+
# -------------------------------------------------------------------------------------------------
4+
# Job Name
5+
# -------------------------------------------------------------------------------------------------
6+
name: lint
67

7-
name: Linting
8+
9+
# -------------------------------------------------------------------------------------------------
10+
# When to run
11+
# -------------------------------------------------------------------------------------------------
812
on:
13+
# Runs on Pull Requests
914
pull_request:
1015

16+
17+
# -------------------------------------------------------------------------------------------------
18+
# What to run
19+
# -------------------------------------------------------------------------------------------------
1120
jobs:
1221
lint:
13-
name: "[ ${{ matrix.job }} ]"
22+
name: "Lint"
1423
runs-on: ubuntu-latest
15-
strategy:
16-
fail-fast: False
17-
matrix:
18-
job: [gen-dockerfiles]
1924
steps:
25+
# ------------------------------------------------------------
26+
# Setup repository
27+
# ------------------------------------------------------------
2028
- name: Checkout repository
2129
uses: actions/checkout@v2
30+
with:
31+
fetch-depth: 0
32+
33+
# ------------------------------------------------------------
34+
# Lint repository
35+
# ------------------------------------------------------------
36+
- name: Lint Files
37+
run: |
38+
make lint-files
39+
40+
- name: Lint Yaml
41+
run: |
42+
make lint-yaml
43+
44+
- name: Lint workflow
45+
run: |
46+
make lint-workflow
47+
48+
- name: Lint Changelog
49+
run: |
50+
make lint-changelog
51+
2252
- name: Diff generated Docker files
2353
run: |
24-
make "${JOB}"
54+
make gen-dockerfiles
2555
git diff --quiet || { echo "Build Changes"; git diff; git status; false; }
26-
env:
27-
JOB: ${{ matrix.job }}

0 commit comments

Comments
 (0)