-
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (77 loc) · 2.89 KB
/
images.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Images
on:
pull_request:
push:
workflow_dispatch:
schedule:
- cron: '0 5 * * 1,4'
defaults:
run:
shell: "bash -Eeuo pipefail -x {0}"
jobs:
init:
name: Generate Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
version: ${{ steps.generate-matrix.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate job matrix from upstream versions.json
run: |
version=$(curl https://api.github.com/repos/nextcloud/docker/releases/latest | jq -r '.tag_name')
echo "version=$version" >> "$GITHUB_OUTPUT"
wget https://raw.githubusercontent.com/nextcloud/docker/$version/versions.json
echo "matrix=$(jq '{"base": (.[].variants | keys_unsorted | unique), "version": (map(.version) | unique | sort)}' versions.json | jq -cs '.[0]')" >> "$GITHUB_OUTPUT"
id: generate-matrix
build:
needs: init
strategy:
matrix: ${{ fromJson(needs.init.outputs.matrix) }}
name: "${{ matrix.base }}-${{ matrix.version }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN}}
- name: Generate docker tags
id: tags
uses: docker/metadata-action@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
images: |
ghcr.io/${{ github.repository }}
quay.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}},value=${{ matrix.version }},enable=${{ matrix.base == 'apache' }}
type=semver,pattern={{major}}.{{minor}},value=${{ matrix.version }},enable=${{ matrix.base == 'apache' }}
type=semver,pattern={{major}},value=${{ matrix.version }},enable=${{ matrix.base == 'apache' }}
type=semver,pattern={{version}}-${{ matrix.base }},value=${{ matrix.version }}
type=semver,pattern={{major}}.{{minor}}-${{ matrix.base }},value=${{ matrix.version }}
type=semver,pattern={{major}}-${{ matrix.base }},value=${{ matrix.version }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ steps.tags.outputs.tags }}
push: true
file: Dockerfile.${{ matrix.base }}
build-args: |
VERSION=${{ matrix.version }}