-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (69 loc) · 2.21 KB
/
Copy pathpublish.yml
File metadata and controls
81 lines (69 loc) · 2.21 KB
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
name: Publish Docker Image
on:
workflow_dispatch:
inputs:
nextcloud_version:
description: "Nextcloud version (e.g. 30.0.4)"
required: true
type: string
enterprise_url:
description: "Enterprise archive URL (leave empty for community edition)"
required: false
default: ""
type: string
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/nextcloud
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Determine edition
id: edition
run: |
if [ -n "${{ inputs.enterprise_url }}" ]; then
echo "name=enterprise" >> "$GITHUB_OUTPUT"
else
echo "name=community" >> "$GITHUB_OUTPUT"
fi
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Lower case docker image name
id: docker_image
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository }}
- name: Generate image tags
id: tags
run: |
VERSION="${{ inputs.nextcloud_version }}"
EDITION="${{ steps.edition.outputs.name }}"
IMAGE="${{ env.REGISTRY }}/${{ steps.docker_image.outputs.lowercase }}"
if [ "$EDITION" = "enterprise" ]; then
TAGS="${IMAGE}:${VERSION}-enterprise"
else
TAGS="${IMAGE}:${VERSION}"
fi
echo "tags=$TAGS" >> "$GITHUB_OUTPUT"
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./nextcloud
push: true
tags: ${{ steps.tags.outputs.tags }}
build-args: |
NEXTCLOUD_VERSION=${{ inputs.nextcloud_version }}
ENTERPRISE_ARCHIVE_URL=${{ inputs.enterprise_url }}
cache-from: type=gha
cache-to: type=gha,mode=max