fork/static-web-server

git clone https://git.julia.blue/fork/static-web-server

Jose Quintanarefactor: update github ci workflows (#514)1c4929d

allow-symlink
5.3 KiB184 linesraw
1name: release-docker
2on:
3  release:
4    types:
5      - published
6
7jobs:
8  docker-image-alpine:
9    runs-on: ubuntu-22.04
10    if: contains(github.ref, 'v2.')
11    steps:
12      -
13        name: Checkout repository
14        uses: actions/checkout@v4
15        with:
16          fetch-depth: 1
17      -
18        name: Set up QEMU
19        uses: docker/setup-qemu-action@v3
20      -
21        name: Docker meta alpine
22        id: meta_alpine
23        uses: docker/metadata-action@v5
24        with:
25          images: |
26            joseluisq/static-web-server
27            ghcr.io/static-web-server/static-web-server
28          flavor: |
29            latest=false
30            suffix=-alpine
31          tags: |
32            type=semver,pattern={{version}}
33            type=semver,pattern={{major}}.{{minor}}
34            type=semver,pattern={{major}}
35      -
36        name: Set up Docker Buildx
37        uses: docker/setup-buildx-action@v3
38      -
39        name: Login to DockerHub
40        uses: docker/login-action@v3
41        with:
42          username: ${{ secrets.DOCKERHUB_USERNAME }}
43          password: ${{ secrets.DOCKERHUB_TOKEN }}
44      -
45        name: Login to ghcr.io
46        uses: docker/login-action@v3
47        with:
48          registry: ghcr.io
49          username: ${{ github.actor }}
50          password: ${{ secrets.GITHUB_TOKEN }}
51      -
52        name: Prepare Docker envs
53        shell: bash
54        run: |
55          echo "SERVER_VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV
56      -
57        name: Build and push (alpine)
58        uses: docker/build-push-action@v6
59        with:
60          push: true
61          context: .
62          platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6
63          file: ./docker/alpine/Dockerfile
64          tags: ${{ steps.meta_alpine.outputs.tags }}
65          build-args: |
66            SERVER_VERSION=${{ env.SERVER_VERSION }}
67
68  docker-image-debian:
69    needs: ['docker-image-alpine']
70    runs-on: ubuntu-22.04
71    if: contains(github.ref, 'v2.')
72    steps:
73      -
74        name: Checkout repository
75        uses: actions/checkout@v4
76        with:
77          fetch-depth: 1
78      -
79        name: Set up QEMU
80        uses: docker/setup-qemu-action@v3
81      -
82        name: Docker meta debian
83        id: meta_debian
84        uses: docker/metadata-action@v5
85        with:
86          images: |
87            joseluisq/static-web-server
88            ghcr.io/static-web-server/static-web-server
89          flavor: |
90            latest=false
91            suffix=-debian
92          tags: |
93            type=semver,pattern={{version}}
94            type=semver,pattern={{major}}.{{minor}}
95            type=semver,pattern={{major}}
96      -
97        name: Set up Docker Buildx
98        uses: docker/setup-buildx-action@v3
99      -
100        name: Login to DockerHub
101        uses: docker/login-action@v3
102        with:
103          username: ${{ secrets.DOCKERHUB_USERNAME }}
104          password: ${{ secrets.DOCKERHUB_TOKEN }}
105      -
106        name: Login to ghcr.io
107        uses: docker/login-action@v3
108        with:
109          registry: ghcr.io
110          username: ${{ github.actor }}
111          password: ${{ secrets.GITHUB_TOKEN }}
112      -
113        name: Prepare Docker envs
114        shell: bash
115        run: |
116          echo "SERVER_VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV
117      -
118        name: Build and push (debian)
119        uses: docker/build-push-action@v6
120        with:
121          push: true
122          context: .
123          platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6,linux/ppc64le,linux/s390x
124          file: ./docker/debian/Dockerfile
125          tags: ${{ steps.meta_debian.outputs.tags }}
126          build-args: |
127            SERVER_VERSION=${{ env.SERVER_VERSION }}
128
129  docker-image-scratch:
130    needs: ['docker-image-alpine']
131    runs-on: ubuntu-22.04
132    steps:
133      -
134        name: Checkout repository
135        uses: actions/checkout@v4
136        with:
137          fetch-depth: 1
138      -
139        name: Set up QEMU
140        uses: docker/setup-qemu-action@v3
141      -
142        name: Docker meta scratch
143        id: meta_scratch
144        uses: docker/metadata-action@v5
145        with:
146          images: |
147            joseluisq/static-web-server
148            ghcr.io/static-web-server/static-web-server
149          tags: |
150            type=semver,pattern={{version}}
151            type=semver,pattern={{major}}.{{minor}}
152            type=semver,pattern={{major}}
153      -
154        name: Set up Docker Buildx
155        uses: docker/setup-buildx-action@v3
156      -
157        name: Login to DockerHub
158        uses: docker/login-action@v3
159        with:
160          username: ${{ secrets.DOCKERHUB_USERNAME }}
161          password: ${{ secrets.DOCKERHUB_TOKEN }}
162      -
163        name: Login to ghcr.io
164        uses: docker/login-action@v3
165        with:
166          registry: ghcr.io
167          username: ${{ github.actor }}
168          password: ${{ secrets.GITHUB_TOKEN }}
169      -
170        name: Prepare Docker envs
171        shell: bash
172        run: |
173          echo "SERVER_VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV
174      -
175        name: Build and push (scratch)
176        uses: docker/build-push-action@v6
177        with:
178          push: true
179          context: .
180          platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6
181          file: ./docker/scratch/Dockerfile
182          tags: ${{ steps.meta_scratch.outputs.tags }}
183          build-args: |
184            SERVER_VERSION=${{ env.SERVER_VERSION }}