-
Notifications
You must be signed in to change notification settings - Fork 2
53 lines (50 loc) · 1.99 KB
/
caddy-alpine.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
name: caddy-alpine
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
env:
DOCKER_REPO_NAME: rookiezoe/caddy
jobs:
get_env:
runs-on: ubuntu-latest
outputs:
LATEST_TAG: ${{ steps.set_outputs.outputs.LATEST_TAG }}
CADDY_VERSION: ${{ steps.set_outputs.outputs.CADDY_VERSION }}
steps:
- id: set_outputs
env:
DEBIAN_FRONTEND: noninteractive
name: Set outputs
run: |
sudo -E apt-get -qq update
sudo -E apt-get -qq install jq
export QUREY_PARAMS="?page_size=2&page=1&ordering=last_updated"
export LATEST_TAG=$(echo -n $(curl -s "https://hub.docker.com/v2/repositories/${DOCKER_REPO_NAME}/tags/${QUREY_PARAMS}" | jq -r '.results | sort_by(.name) | first | .name'))
export CADDY_VERSION=$(echo -n $(curl -s https://api.github.com/repos/caddyserver/caddy/releases/latest | jq -r '.tag_name' | awk -Fv '{print $2}'))
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_OUTPUT
echo "CADDY_VERSION=$CADDY_VERSION" >> $GITHUB_OUTPUT
publish:
if: needs.get_env.outputs.LATEST_TAG != needs.get_env.outputs.CADDY_VERSION
runs-on: ubuntu-latest
needs: get_env
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Publish to DockerHub
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ env.DOCKER_REPO_NAME }}:latest,${{ env.DOCKER_REPO_NAME }}:${{ needs.get_env.outputs.CADDY_VERSION }}
context: ./caddy
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/riscv64,linux/s390x
build-args: |
CADDY_VERSION=${{ needs.get_env.outputs.CADDY_VERSION }}