-
Notifications
You must be signed in to change notification settings - Fork 2
179 lines (174 loc) · 7.45 KB
/
Sync+build+push TTRSS.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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Sync+build+push TTRSS
on:
# Triggers the workflow on push or pull request events but only for the main branch
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
get_commits:
runs-on: ubuntu-latest
# https://lannonbr.com/blog/2020-04-16-gh-actions-job-outputs
outputs:
LOCAL: ${{ steps.commits.outputs.SETLOCAL }}
REMOTE: ${{ steps.commits.outputs.SETREMOTE }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: 'TTRSS-docker' # branch
- name: set local and remote latest commit as environment variables
id: commits
# https://lannonbr.com/blog/2020-04-16-gh-actions-job-outputs
# https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs
# echo "::set-output name=SETREMOTE::$(git ls-remote https://git.tt-rss.org/fox/ttrss-docker-compose.git HEAD | awk '{ print $1 }')"
# fox updates the docker image based on the tt-rss repo instead of ttrss-docker-compose for some reason, so it's better to do the same
run: |
echo "SETREMOTE=$(git ls-remote https://git.tt-rss.org/fox/tt-rss.git HEAD | awk '{ print $1 }')" >> $GITHUB_OUTPUT
echo "SETLOCAL=$(cat last_sync_with_original_repo_commit_id)" >> $GITHUB_OUTPUT
repo_sync:
needs: [get_commits]
runs-on: ubuntu-latest
# https://lannonbr.com/blog/2020-04-16-gh-actions-job-outputs
if: ${{ needs.get_commits.outputs.LOCAL != needs.get_commits.outputs.REMOTE || github.event_name == 'workflow_dispatch' }}
steps:
- name: repo-sync
uses: wei/git-sync@v3
with:
source_repo: "https://git.tt-rss.org/fox/tt-rss.git"
source_branch: "master"
destination_repo: "[email protected]:schklom/Mirror-workflows.git"
destination_branch: "TTRSS-docker"
ssh_private_key: ${{ secrets.GITSYNCACTION }}
# uses: repo-sync/github-sync@v2
# with:
# source_repo: "https://git.tt-rss.org/fox/ttrss-docker-compose.git"
# source_branch: "master"
# destination_branch: "TTRSS-docker"
# github_token: ${{ secrets.REPO_SYNC_GITHUB_SYNC_PERSONAL_ACCESS_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
with:
ref: 'TTRSS-docker' # branch
- name: get most recent commit id on original repo, for next comparison on sync
run: git ls-remote https://git.tt-rss.org/fox/tt-rss.git HEAD | awk '{ print $1 }' > last_sync_with_original_repo_commit_id
- name: Commit and push the change
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Add last_sync_with_original_repo_commit_id
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
#- uses: actions/checkout@v4
#with:
#ref: 'TTRSS-docker'
#- name: app dockerfile
# run: sed -r 's/^FROM ([a-zA-Z]+)(.*)$/FROM arm32v7\/\1\2/' src/app/Dockerfile > src/app/Dockerfile
#- name: adapt web dockerfile
# run: sed -r 's/^FROM abiosoft\/caddy:no-stats$/FROM jessestuart\/caddy/' web/Dockerfile > web/Dockerfile
# https://github.com/marketplace/actions/git-auto-commit
#- name: pushing web Dockerfile changes to main branch
# uses: stefanzweifel/git-auto-commit-action@v5
# with:
# Optional but recommended
# Defaults to "Apply automatic changes"
# commit_message: Updated web Dockerfile to work with Raspberry Pi 4
build_push:
needs: [repo_sync]
#needs: [get_commits]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
#repository: 'schklom/TTRSS-mirror'
ref: 'TTRSS-docker' # branch
# https://github.com/docker/setup-qemu-action#usage
- name: Set up QEMU
uses: docker/[email protected]
#with:
#image: tonistiigi/binfmt:latest
#platforms: all
#platforms: arm/v7
# https://github.com/marketplace/actions/docker-setup-buildx
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
#with:
#install: true
#- name: Available platforms
# run: echo ${{ steps.buildx.outputs.platforms }}
# https://github.com/docker/login-action#docker-hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# https://github.com/docker/build-push-action#multi-platform-image
- name: Build and push TTRSS app
uses: docker/build-push-action@v6
with:
context: ./
file: ./.docker/app/Dockerfile
# https://tt-rss.org/wiki/InstallationNotes/#your-images-wont-run-on-raspberry-pi
build-args: BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
#platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
pull: true
push: true
tags: |
schklom/ttrss-app:latest
- name: Build and push TTRSS web-nginx
uses: docker/build-push-action@v6
with:
context: ./
file: ./.docker/web-nginx/Dockerfile
#platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
pull: true
push: true
tags: |
schklom/ttrss-web-nginx:latest
build_push_filelogging:
needs: [build_push]
#needs: [get_commits]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
#repository: 'schklom/TTRSS-mirror'
ref: 'TTRSS-docker-with-filelogging' # branch
# https://github.com/docker/setup-qemu-action#usage
- name: Set up QEMU
uses: docker/[email protected]
#with:
#image: tonistiigi/binfmt:latest
#platforms: all
#platforms: arm/v7
# https://github.com/marketplace/actions/docker-setup-buildx
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
#with:
#install: true
#- name: Available platforms
# run: echo ${{ steps.buildx.outputs.platforms }}
# https://github.com/docker/login-action#docker-hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# https://github.com/docker/build-push-action#multi-platform-image
- name: Build and push TTRSS app (with file logging)
uses: docker/build-push-action@v6
with:
context: ./
file: ./Dockerfile
# https://tt-rss.org/wiki/InstallationNotes/#your-images-wont-run-on-raspberry-pi
build-args: BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
#platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
pull: true
push: true
tags: |
schklom/ttrss-app:with-filelogging-latest