-
Notifications
You must be signed in to change notification settings - Fork 807
121 lines (113 loc) · 4.7 KB
/
push-web-only.yml
File metadata and controls
121 lines (113 loc) · 4.7 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
on:
# push:
# branches:
# - main
schedule:
- cron: "0 0 * * *"
env:
BUILDKIT_PROGRESS: plain
DOCKER_REPO: discourse/discourse
jobs:
version:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.latest.outputs.version }}
esr: ${{ steps.esr.outputs.version }}
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- name: checkout tests passed
uses: actions/checkout@v4
with:
repository: discourse/discourse
ref: latest
fetch-depth: 1
path: 'latest'
- name: checkout esr
uses: actions/checkout@v4
with:
repository: discourse/discourse
ref: esr
fetch-depth: 1
path: 'esr'
- id: latest
working-directory: latest
run: |
version=$(ruby -r ./lib/version.rb -e "puts ::Discourse::VERSION::STRING")
echo "version=$version"
echo "version=$version" >> $GITHUB_OUTPUT
- id: esr
working-directory: esr
run: |
version=$(ruby -r ./lib/version.rb -e "puts ::Discourse::VERSION::STRING")
echo "version=$version"
echo "version=$version" >> $GITHUB_OUTPUT
push:
strategy:
matrix:
version: [latest,esr]
os: [ubuntu-latest, ubuntu-24.04-arm]
runs-on: ${{ matrix.os }}
needs: version
env:
ARCH: ${{ matrix.os == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}
FLOATING_TAG: ${{ matrix.version == 'latest' && 'latest' || matrix.version }}-${{ matrix.os == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}
TAG: ${{ matrix.version == 'esr' && needs.version.outputs.esr || needs.version.outputs.latest }}-${{ matrix.os == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: download-launcher
run: |
BINDIR="bin"
package="${BINDIR}/launcher.tar.gz"
curl -s -o ${package} -L https://get.discourse.org/launcher/latest/launcher-linux-${{ env.ARCH }}.tar.gz
tar -zxf ${package} -C ${BINDIR}
rm ${package}
- uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: build
run: |
# TODO: can we find a way to override or provide pups params at build time?
# Then we can do something like:
# bin/launcher build --params="version=esr" --conf-dir=./samples web_only
cp ./samples/web_only.yml ./containers/web_only.yml
echo $(grep base_image: ./templates/web.template.yml)-web-only >> ./containers/web_only.yml
sed -Ei 's/^ *+#?version:.*/ version: ${{ matrix.version }}/' ./containers/web_only.yml
sed -Ei '/^env:.*/a\ DISABLE_LETSENCRYPT: 1' ./containers/web_only.yml
sed -Ei '/^ *+- "templates\/web.template.yml"/a\ - "templates/offline-page.template.yml"' ./containers/web_only.yml
sed -Ei 's/^ *+#- "templates\/web.ssl.template.yml"/ - "templates\/web.ssl.template.yml"/' ./containers/web_only.yml
sed -Ei 's/^ *+#- "templates\/web.letsencrypt.ssl.template.yml"/ - "templates\/web.letsencrypt.ssl.template.yml"/' ./containers/web_only.yml
bin/launcher build web_only \
--tag ${{ env.DOCKER_REPO }}:${{ env.FLOATING_TAG }} \
--tag ${{ env.DOCKER_REPO }}:${{ env.TAG }} \
--push
manifest:
runs-on: ubuntu-latest
needs: [version, push]
steps:
- uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: update manifest
run: |
docker buildx imagetools create -t ${{ env.DOCKER_REPO }}:latest \
${{ env.DOCKER_REPO }}:latest-amd64 \
${{ env.DOCKER_REPO }}:latest-arm64
docker buildx imagetools create -t ${{ env.DOCKER_REPO }}:esr \
${{ env.DOCKER_REPO }}:esr-amd64 \
${{ env.DOCKER_REPO }}:esr-arm64
docker buildx imagetools create -t ${{ env.DOCKER_REPO }}:${{ needs.version.outputs.latest }} \
${{ env.DOCKER_REPO }}:${{ needs.version.outputs.latest }}-amd64 \
${{ env.DOCKER_REPO }}:${{ needs.version.outputs.latest }}-arm64
docker buildx imagetools create -t ${{ env.DOCKER_REPO }}:${{ needs.version.outputs.esr }} \
${{ env.DOCKER_REPO }}:${{ needs.version.outputs.esr }}-amd64 \
${{ env.DOCKER_REPO }}:${{ needs.version.outputs.esr }}-arm64