Skip to content

Commit 141ce0d

Browse files
committed
init
Signed-off-by: Zoey <[email protected]>
0 parents  commit 141ce0d

File tree

13 files changed

+1485
-0
lines changed

13 files changed

+1485
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
exclude:
2+
- main
3+
- stable
4+
- develop
5+
delete_closed_pr: true

.github/workflows/docker-latest.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Docker push develop to latest
2+
on:
3+
workflow_dispatch:
4+
jobs:
5+
docker:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Login to DockerHub
9+
if: github.event_name != 'pull_request'
10+
uses: docker/login-action@v2
11+
with:
12+
username: ${{ secrets.DOCKER_USERNAME }}
13+
password: ${{ secrets.DOCKER_PASSWORD }}
14+
- name: Convert Username
15+
id: un
16+
run: echo "un=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
17+
- name: Login to GitHub Container Registry
18+
uses: docker/login-action@v2
19+
with:
20+
registry: ghcr.io
21+
username: ${{ steps.un.outputs.un }}
22+
password: ${{ github.token }}
23+
- name: Push develop to latest
24+
run: |
25+
docker buildx imagetools create --tag ${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:latest ${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }}
26+
docker buildx imagetools create --tag ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:latest ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }}
27+
- name: Show Nginx version
28+
run: |
29+
docker run --rm ${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:latest -V
30+
docker run --rm ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:latest -V

.github/workflows/docker.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Build Docker Image
2+
on:
3+
schedule:
4+
- cron: "0 0 */6 * *"
5+
push:
6+
branches:
7+
- latest
8+
- develop
9+
paths:
10+
- Dockerfile
11+
- .github/workflows/docker.yml
12+
pull_request:
13+
paths:
14+
- Dockerfile
15+
- .github/workflows/docker.yml
16+
workflow_dispatch:
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v2
25+
with:
26+
platforms: arm64 #all
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v2
29+
with:
30+
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=-1
31+
- name: Login to DockerHub
32+
if: ${{ github.event_name != 'pull_request' }}
33+
uses: docker/login-action@v2
34+
with:
35+
username: ${{ secrets.DOCKER_USERNAME }}
36+
password: ${{ secrets.DOCKER_PASSWORD }}
37+
- name: Convert Username
38+
id: un
39+
run: echo "un=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
40+
- name: Login to GitHub Container Registry
41+
uses: docker/login-action@v2
42+
with:
43+
registry: ghcr.io
44+
username: ${{ steps.un.outputs.un }}
45+
password: ${{ github.token }}
46+
- name: Build
47+
uses: docker/build-push-action@v4
48+
if: ${{ github.event_name != 'pull_request' }}
49+
with:
50+
context: .
51+
file: ./Dockerfile
52+
platforms: linux/amd64,linux/arm64 #,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4 #,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
53+
push: ${{ github.event_name != 'pull_request' }}
54+
tags: |
55+
${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }}
56+
${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.run_number }}
57+
ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }}
58+
ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.run_number }}
59+
build-args: |
60+
"BUILD=${{ github.event.repository.name }}"
61+
- name: show version
62+
if: ${{ github.event_name != 'pull_request' }}
63+
run: |
64+
docker run --rm ${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }} -V
65+
docker run --rm ${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.run_number }} -V
66+
docker run --rm ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }} -V
67+
docker run --rm ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.run_number }} -V
68+
- name: copy nginx binary
69+
if: ${{ github.event_name != 'pull_request' }}
70+
run: |
71+
docker run -d --pull always --platform amd64 --name nginx-x86_64 ${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }}
72+
docker cp nginx-x86_64:/usr/local/nginx/sbin/nginx nginx-x86_64
73+
docker run -d --pull always --platform arm64 --name nginx-aarch64 ${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }}
74+
docker cp nginx-aarch64:/usr/local/nginx/sbin/nginx nginx-aarch64
75+
- uses: actions/upload-artifact@v3
76+
if: ${{ github.event_name != 'pull_request' }}
77+
with:
78+
name: artifacts
79+
path: |
80+
nginx-x86_64
81+
nginx-aarch64
82+
- uses: "marvinpinto/action-automatic-releases@latest"
83+
if: ${{ github.event_name != 'pull_request' }}
84+
with:
85+
prerelease: false
86+
repo_token: ${{ github.token }}
87+
title: ${{ github.run_number }}
88+
automatic_release_tag: ${{ github.run_number }}
89+
files: |
90+
nginx-x86_64
91+
nginx-aarch64
92+
- name: Set PR-Number (PR)
93+
if: ${{ github.event_name == 'pull_request' }}
94+
id: pr
95+
run: echo "pr=$(echo pr-${{ github.ref_name }} | sed "s|refs/pull/:||g" | sed "s|/merge||g")" >> $GITHUB_OUTPUT
96+
- name: Build (PR)
97+
uses: docker/build-push-action@v4
98+
if: ${{ github.event_name == 'pull_request' }}
99+
with:
100+
context: .
101+
file: ./Dockerfile
102+
platforms: linux/amd64,linux/arm64 #,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4 #,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
103+
push: ${{ github.event_name == 'pull_request' }}
104+
tags: ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.pr.outputs.pr }}
105+
build-args: |
106+
"BUILD=${{ github.event.repository.name }}"
107+
- name: show version (PR)
108+
if: ${{ github.event_name == 'pull_request' }}
109+
run: docker run --rm ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.pr.outputs.pr }} -V
110+
- name: add comment (PR)
111+
uses: mshick/add-pr-comment@v2
112+
if: ${{ github.event_name == 'pull_request' }}
113+
with:
114+
message: "The Docker Image can now be found here: `ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.pr.outputs.pr }}`"
115+
repo-token: ${{ github.token }}

.github/workflows/json.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: JSON check
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
jobs:
7+
test-json:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: json-syntax-check
12+
uses: limitusus/json-syntax-check@v2
13+
with:
14+
pattern: "\\.json$*"

.github/workflows/spellcheck.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: reviewdog
2+
on: [pull_request]
3+
jobs:
4+
misspell:
5+
name: runner / misspell
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Check out code.
9+
uses: actions/checkout@v3
10+
- name: misspell
11+
uses: reviewdog/action-misspell@v1
12+
with:
13+
github_token: ${{ secrets.github_token }}
14+
locale: "US"

.github/workflows/yq.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: yq
2+
on:
3+
workflow_dispatch:
4+
jobs:
5+
yq:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v3
10+
with:
11+
token: ${{ secrets.YQ }}
12+
- name: update workflows
13+
run: for workflow in .github/workflows/*.yml; do yq "$workflow" | tee "$workflow".tmp && mv "$workflow".tmp "$workflow"; done
14+
- name: push changes
15+
run: |
16+
git config user.name "GitHub"
17+
git config user.email "[email protected]"
18+
git add -A
19+
git diff-index --quiet HEAD || git commit -sm "yq"
20+
git push

0 commit comments

Comments
 (0)