Skip to content

Commit dfd2c8b

Browse files
authored
Merge pull request #36 from devilbox/release-0.40
Release 0.40
2 parents c16cdb4 + 8636521 commit dfd2c8b

File tree

13 files changed

+413
-261
lines changed

13 files changed

+413
-261
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"

.github/workflows/build.yml

Lines changed: 110 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -10,148 +10,151 @@ name: build
1010
# When to run
1111
# -------------------------------------------------------------------------------------------------
1212
on:
13-
# Runs on Pull Requests
14-
pull_request:
1513
# Runs on Push
1614
push:
1715

1816

19-
# -------------------------------------------------------------------------------------------------
20-
# What to run
21-
# -------------------------------------------------------------------------------------------------
2217
jobs:
18+
19+
# -----------------------------------------------------------------------------------------------
20+
# Job (1/2): BUILD
21+
# -----------------------------------------------------------------------------------------------
2322
build:
24-
name: "[ HTTPD ]"
23+
name: "[ ${{ matrix.version }} (${{ matrix.arch }}) ]"
2524
runs-on: ubuntu-latest
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
version:
29+
- 'Nginx stable'
30+
arch:
31+
- 'linux/amd64'
32+
- 'linux/arm64'
33+
- 'linux/386'
34+
- 'linux/arm/v7'
35+
- 'linux/arm/v6'
2636
steps:
2737

2838
# ------------------------------------------------------------
2939
# Setup repository
3040
# ------------------------------------------------------------
31-
- name: Checkout repository
41+
- name: "[SETUP] Checkout repository"
3242
uses: actions/checkout@v2
3343
with:
3444
fetch-depth: 0
3545

36-
- name: Set variables
37-
id: vars
38-
run: |
39-
40-
# Retrieve git info (tags, etc)
41-
git fetch --all
42-
43-
# Branch, Tag or Commit
44-
GIT_TYPE="$( \
45-
curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \
46-
| sh \
47-
| grep '^GIT_TYPE' \
48-
| sed 's|.*=||g' \
49-
)"
50-
# Branch name, Tag name or Commit Hash
51-
GIT_SLUG="$( \
52-
curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \
53-
| sh \
54-
| grep '^GIT_NAME' \
55-
| sed 's|.*=||g' \
56-
)"
57-
# Docker Tag
58-
if [ "${GIT_TYPE}" = "BRANCH" ] && [ "${GIT_SLUG}" = "master" ]; then
59-
DOCKER_TAG="latest"
60-
else
61-
DOCKER_TAG="${GIT_SLUG}"
62-
fi
63-
64-
# Output
65-
echo "GIT_TYPE=${GIT_TYPE}"
66-
echo "GIT_SLUG=${GIT_SLUG}"
67-
echo "DOCKER_TAG=${DOCKER_TAG}"
68-
69-
# Export variable
70-
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files
71-
echo "GIT_TYPE=${GIT_TYPE}" >> ${GITHUB_ENV}
72-
echo "GIT_SLUG=${GIT_SLUG}" >> ${GITHUB_ENV}
73-
echo "DOCKER_TAG=${DOCKER_TAG}" >> ${GITHUB_ENV}
46+
- name: "[SETUP] Setup QEMU environment"
47+
uses: docker/setup-qemu-action@v1
48+
with:
49+
image: tonistiigi/binfmt:latest
50+
platforms: all
7451

52+
- name: "[SETUP] Determine Docker tag"
53+
id: tag
54+
uses: cytopia/[email protected]
7555

7656
# ------------------------------------------------------------
7757
# Build
7858
# ------------------------------------------------------------
7959
- name: Build
80-
run: |
81-
retry() {
82-
for n in $(seq ${RETRIES}); do
83-
echo "[${n}/${RETRIES}] ${*}";
84-
if eval "${*}"; then
85-
echo "[SUCC] ${n}/${RETRIES}";
86-
return 0;
87-
fi;
88-
sleep ${PAUSE};
89-
echo "[FAIL] ${n}/${RETRIES}";
90-
done;
91-
return 1;
92-
}
93-
retry make build
60+
uses: cytopia/[email protected]
61+
with:
62+
command: |
63+
make build ARCH=${ARCH}
9464
env:
95-
RETRIES: 20
96-
PAUSE: 10
65+
ARCH: ${{ matrix.arch }}
9766

9867
# ------------------------------------------------------------
9968
# Test
10069
# ------------------------------------------------------------
101-
- name: Test Docker Image
102-
run: |
103-
retry() {
104-
for n in $(seq ${RETRIES}); do
105-
echo "[${n}/${RETRIES}] ${*}";
106-
if eval "${*}"; then
107-
echo "[SUCC] ${n}/${RETRIES}";
108-
return 0;
109-
fi;
110-
sleep ${PAUSE};
111-
echo "[FAIL] ${n}/${RETRIES}";
112-
done;
113-
return 1;
114-
}
115-
retry make test
70+
- name: "[TEST] Docker Image"
71+
uses: cytopia/[email protected]
72+
with:
73+
command: |
74+
make test ARCH=${ARCH}
11675
env:
117-
RETRIES: 20
118-
PAUSE: 10
76+
ARCH: ${{ matrix.arch }}
11977

78+
- name: "[TEST] Update README"
79+
uses: cytopia/[email protected]
80+
with:
81+
command: |
82+
make update-readme ARCH=${ARCH}
83+
env:
84+
ARCH: ${{ matrix.arch }}
12085

12186
# ------------------------------------------------------------
12287
# Deploy
12388
# ------------------------------------------------------------
124-
- name: Publish images (only repo owner)
125-
run: |
126-
retry() {
127-
for n in $(seq ${RETRIES}); do
128-
echo "[${n}/${RETRIES}] ${*}";
129-
if eval "${*}"; then
130-
echo "[SUCC] ${n}/${RETRIES}";
131-
return 0;
132-
fi;
133-
sleep ${PAUSE};
134-
echo "[FAIL] ${n}/${RETRIES}";
135-
done;
136-
return 1;
137-
}
138-
139-
# Output
140-
echo "GIT_TYPE=${GIT_TYPE}"
141-
echo "GIT_SLUG=${GIT_SLUG}"
142-
echo "DOCKER_TAG=${DOCKER_TAG}"
143-
144-
# Tag image
145-
retry make tag TAG=${DOCKER_TAG}
146-
docker images
147-
148-
# Login and Push
149-
retry make login USER=${{ secrets.DOCKERHUB_USERNAME }} PASS=${{ secrets.DOCKERHUB_PASSWORD }}
150-
retry make push TAG=${DOCKER_TAG}
89+
- name: "[DEPLOY] Login"
90+
uses: docker/login-action@v1
91+
with:
92+
username: ${{ secrets.DOCKERHUB_USERNAME }}
93+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
15194

95+
- name: "[DEPLOY] Publish architecture image (only repo owner)"
96+
uses: cytopia/[email protected]
97+
with:
98+
command: |
99+
make push-arch TAG=${{ steps.tag.outputs.docker-tag }} ARCH=${ARCH}
152100
env:
153-
RETRIES: 20
154-
PAUSE: 10
101+
ARCH: ${{ matrix.arch }}
102+
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions
103+
if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
104+
&& (
105+
(github.event_name == 'schedule' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
106+
||
107+
(github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
108+
||
109+
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-'))
110+
)
111+
112+
# -----------------------------------------------------------------------------------------------
113+
# Job (2/2): DEPLOY
114+
# -----------------------------------------------------------------------------------------------
115+
deploy:
116+
needs: [build]
117+
name: Deploy
118+
runs-on: ubuntu-latest
119+
strategy:
120+
fail-fast: false
121+
matrix:
122+
version:
123+
- 'Nginx stable'
124+
steps:
125+
126+
# ------------------------------------------------------------
127+
# Setup repository
128+
# ------------------------------------------------------------
129+
- name: "[SETUP] Checkout repository"
130+
uses: actions/checkout@v2
131+
with:
132+
fetch-depth: 0
133+
134+
- name: "[SETUP] Determine Docker tag"
135+
id: tag
136+
uses: cytopia/[email protected]
137+
138+
# ------------------------------------------------------------
139+
# Deploy
140+
# ------------------------------------------------------------
141+
- name: "[DEPLOY] Login"
142+
uses: docker/login-action@v1
143+
with:
144+
username: ${{ secrets.DOCKERHUB_USERNAME }}
145+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
146+
147+
- name: "[DEPLOY] Create Docker manifest"
148+
uses: cytopia/[email protected]
149+
with:
150+
command: |
151+
make manifest-create TAG=${{ steps.tag.outputs.docker-tag }} ARCH="linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6"
152+
153+
- name: "[DEPLOY] Publish Docker manifest (only repo owner)"
154+
uses: cytopia/[email protected]
155+
with:
156+
command: |
157+
make manifest-push TAG=${{ steps.tag.outputs.docker-tag }}
155158
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions
156159
if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
157160
&& (

.github/workflows/contributor.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
3+
# -------------------------------------------------------------------------------------------------
4+
# Job Name
5+
# -------------------------------------------------------------------------------------------------
6+
name: build
7+
8+
9+
# -------------------------------------------------------------------------------------------------
10+
# When to run
11+
# -------------------------------------------------------------------------------------------------
12+
on:
13+
# Runs on Pull Requests
14+
pull_request:
15+
16+
17+
jobs:
18+
19+
# -----------------------------------------------------------------------------------------------
20+
# Job (1/2): BUILD
21+
# -----------------------------------------------------------------------------------------------
22+
build:
23+
name: "[ ${{ matrix.version }} (${{ matrix.arch }}) ]"
24+
runs-on: ubuntu-latest
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
version:
29+
- 'Nginx stable'
30+
arch:
31+
- 'linux/amd64'
32+
- 'linux/arm64'
33+
- 'linux/386'
34+
- 'linux/arm/v7'
35+
- 'linux/arm/v6'
36+
# Only run for forks (contributor)
37+
if: ${{ github.event.pull_request.head.repo.fork }}
38+
steps:
39+
40+
# ------------------------------------------------------------
41+
# Setup repository
42+
# ------------------------------------------------------------
43+
- name: "[SETUP] Checkout repository"
44+
uses: actions/checkout@v2
45+
with:
46+
fetch-depth: 0
47+
48+
- name: "[SETUP] Setup QEMU environment"
49+
uses: docker/setup-qemu-action@v1
50+
with:
51+
image: tonistiigi/binfmt:latest
52+
platforms: all
53+
54+
- name: "[SETUP] Determine Docker tag"
55+
id: tag
56+
uses: cytopia/[email protected]
57+
58+
# ------------------------------------------------------------
59+
# Build
60+
# ------------------------------------------------------------
61+
- name: Build
62+
uses: cytopia/[email protected]
63+
with:
64+
command: |
65+
make build ARCH=${ARCH}
66+
env:
67+
ARCH: ${{ matrix.arch }}
68+
69+
# ------------------------------------------------------------
70+
# Test
71+
# ------------------------------------------------------------
72+
- name: "[TEST] Docker Image"
73+
uses: cytopia/[email protected]
74+
with:
75+
command: |
76+
make test ARCH=${ARCH}
77+
env:
78+
ARCH: ${{ matrix.arch }}
79+
80+
- name: "[TEST] Update README"
81+
uses: cytopia/[email protected]
82+
with:
83+
command: |
84+
make update-readme ARCH=${ARCH}
85+
env:
86+
ARCH: ${{ matrix.arch }}

.github/workflows/lint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ jobs:
3434
# Lint repository
3535
# ------------------------------------------------------------
3636
- name: Lint workflow
37+
id: vars
3738
run: |
3839
make lint-workflow

0 commit comments

Comments
 (0)