Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.40 #36

Merged
merged 3 commits into from
Feb 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
217 changes: 110 additions & 107 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,148 +10,151 @@ name: build
# When to run
# -------------------------------------------------------------------------------------------------
on:
# Runs on Pull Requests
pull_request:
# Runs on Push
push:


# -------------------------------------------------------------------------------------------------
# What to run
# -------------------------------------------------------------------------------------------------
jobs:

# -----------------------------------------------------------------------------------------------
# Job (1/2): BUILD
# -----------------------------------------------------------------------------------------------
build:
name: "[ HTTPD ]"
name: "[ ${{ matrix.version }} (${{ matrix.arch }}) ]"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- 'Nginx stable'
arch:
- 'linux/amd64'
- 'linux/arm64'
- 'linux/386'
- 'linux/arm/v7'
- 'linux/arm/v6'
steps:

# ------------------------------------------------------------
# Setup repository
# ------------------------------------------------------------
- name: Checkout repository
- name: "[SETUP] Checkout repository"
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set variables
id: vars
run: |

# Retrieve git info (tags, etc)
git fetch --all

# Branch, Tag or Commit
GIT_TYPE="$( \
curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \
| sh \
| grep '^GIT_TYPE' \
| sed 's|.*=||g' \
)"
# Branch name, Tag name or Commit Hash
GIT_SLUG="$( \
curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \
| sh \
| grep '^GIT_NAME' \
| sed 's|.*=||g' \
)"
# Docker Tag
if [ "${GIT_TYPE}" = "BRANCH" ] && [ "${GIT_SLUG}" = "master" ]; then
DOCKER_TAG="latest"
else
DOCKER_TAG="${GIT_SLUG}"
fi

# Output
echo "GIT_TYPE=${GIT_TYPE}"
echo "GIT_SLUG=${GIT_SLUG}"
echo "DOCKER_TAG=${DOCKER_TAG}"

# Export variable
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files
echo "GIT_TYPE=${GIT_TYPE}" >> ${GITHUB_ENV}
echo "GIT_SLUG=${GIT_SLUG}" >> ${GITHUB_ENV}
echo "DOCKER_TAG=${DOCKER_TAG}" >> ${GITHUB_ENV}
- name: "[SETUP] Setup QEMU environment"
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: "[SETUP] Determine Docker tag"
id: tag
uses: cytopia/docker-tag@v0.3

# ------------------------------------------------------------
# Build
# ------------------------------------------------------------
- name: Build
run: |
retry() {
for n in $(seq ${RETRIES}); do
echo "[${n}/${RETRIES}] ${*}";
if eval "${*}"; then
echo "[SUCC] ${n}/${RETRIES}";
return 0;
fi;
sleep ${PAUSE};
echo "[FAIL] ${n}/${RETRIES}";
done;
return 1;
}
retry make build
uses: cytopia/shell-command-retry-action@v0.1
with:
command: |
make build ARCH=${ARCH}
env:
RETRIES: 20
PAUSE: 10
ARCH: ${{ matrix.arch }}

# ------------------------------------------------------------
# Test
# ------------------------------------------------------------
- name: Test Docker Image
run: |
retry() {
for n in $(seq ${RETRIES}); do
echo "[${n}/${RETRIES}] ${*}";
if eval "${*}"; then
echo "[SUCC] ${n}/${RETRIES}";
return 0;
fi;
sleep ${PAUSE};
echo "[FAIL] ${n}/${RETRIES}";
done;
return 1;
}
retry make test
- name: "[TEST] Docker Image"
uses: cytopia/shell-command-retry-action@v0.1
with:
command: |
make test ARCH=${ARCH}
env:
RETRIES: 20
PAUSE: 10
ARCH: ${{ matrix.arch }}

- name: "[TEST] Update README"
uses: cytopia/shell-command-retry-action@v0.1
with:
command: |
make update-readme ARCH=${ARCH}
env:
ARCH: ${{ matrix.arch }}

# ------------------------------------------------------------
# Deploy
# ------------------------------------------------------------
- name: Publish images (only repo owner)
run: |
retry() {
for n in $(seq ${RETRIES}); do
echo "[${n}/${RETRIES}] ${*}";
if eval "${*}"; then
echo "[SUCC] ${n}/${RETRIES}";
return 0;
fi;
sleep ${PAUSE};
echo "[FAIL] ${n}/${RETRIES}";
done;
return 1;
}

# Output
echo "GIT_TYPE=${GIT_TYPE}"
echo "GIT_SLUG=${GIT_SLUG}"
echo "DOCKER_TAG=${DOCKER_TAG}"

# Tag image
retry make tag TAG=${DOCKER_TAG}
docker images

# Login and Push
retry make login USER=${{ secrets.DOCKERHUB_USERNAME }} PASS=${{ secrets.DOCKERHUB_PASSWORD }}
retry make push TAG=${DOCKER_TAG}
- name: "[DEPLOY] Login"
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: "[DEPLOY] Publish architecture image (only repo owner)"
uses: cytopia/shell-command-retry-action@v0.1
with:
command: |
make push-arch TAG=${{ steps.tag.outputs.docker-tag }} ARCH=${ARCH}
env:
RETRIES: 20
PAUSE: 10
ARCH: ${{ matrix.arch }}
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions
if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
&& (
(github.event_name == 'schedule' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
||
(github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
||
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-'))
)

# -----------------------------------------------------------------------------------------------
# Job (2/2): DEPLOY
# -----------------------------------------------------------------------------------------------
deploy:
needs: [build]
name: Deploy
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- 'Nginx stable'
steps:

# ------------------------------------------------------------
# Setup repository
# ------------------------------------------------------------
- name: "[SETUP] Checkout repository"
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: "[SETUP] Determine Docker tag"
id: tag
uses: cytopia/docker-tag@v0.3

# ------------------------------------------------------------
# Deploy
# ------------------------------------------------------------
- name: "[DEPLOY] Login"
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: "[DEPLOY] Create Docker manifest"
uses: cytopia/shell-command-retry-action@v0.1
with:
command: |
make manifest-create TAG=${{ steps.tag.outputs.docker-tag }} ARCH="linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6"

- name: "[DEPLOY] Publish Docker manifest (only repo owner)"
uses: cytopia/shell-command-retry-action@v0.1
with:
command: |
make manifest-push TAG=${{ steps.tag.outputs.docker-tag }}
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions
if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
&& (
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/contributor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---

# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: build


# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
# Runs on Pull Requests
pull_request:


jobs:

# -----------------------------------------------------------------------------------------------
# Job (1/2): BUILD
# -----------------------------------------------------------------------------------------------
build:
name: "[ ${{ matrix.version }} (${{ matrix.arch }}) ]"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- 'Nginx stable'
arch:
- 'linux/amd64'
- 'linux/arm64'
- 'linux/386'
- 'linux/arm/v7'
- 'linux/arm/v6'
# Only run for forks (contributor)
if: ${{ github.event.pull_request.head.repo.fork }}
steps:

# ------------------------------------------------------------
# Setup repository
# ------------------------------------------------------------
- name: "[SETUP] Checkout repository"
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: "[SETUP] Setup QEMU environment"
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: "[SETUP] Determine Docker tag"
id: tag
uses: cytopia/docker-tag@v0.3

# ------------------------------------------------------------
# Build
# ------------------------------------------------------------
- name: Build
uses: cytopia/shell-command-retry-action@v0.1
with:
command: |
make build ARCH=${ARCH}
env:
ARCH: ${{ matrix.arch }}

# ------------------------------------------------------------
# Test
# ------------------------------------------------------------
- name: "[TEST] Docker Image"
uses: cytopia/shell-command-retry-action@v0.1
with:
command: |
make test ARCH=${ARCH}
env:
ARCH: ${{ matrix.arch }}

- name: "[TEST] Update README"
uses: cytopia/shell-command-retry-action@v0.1
with:
command: |
make update-readme ARCH=${ARCH}
env:
ARCH: ${{ matrix.arch }}
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ jobs:
# Lint repository
# ------------------------------------------------------------
- name: Lint workflow
id: vars
run: |
make lint-workflow
Loading