File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Publish Multi-Arch Docker Image
2+
3+ on :
4+ schedule :
5+ - cron : ' 0 3 * * 1'
6+ workflow_dispatch :
7+
8+ jobs :
9+ build-and-push :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Fetch latest release tag
13+ run : |
14+ latest_tag=$(curl -s https://api.github.com/repos/Kozea/Radicale/releases/latest | jq -r .tag_name)
15+ echo "latest_tag=$latest_tag" >> $GITHUB_ENV
16+
17+ - name : Check last built version
18+ run : |
19+ last_built=$(cat .last_built_version 2>/dev/null || echo "")
20+ echo "last_built=$last_built" >> $GITHUB_ENV
21+
22+ - name : Build and push if new release
23+ if : env.latest_tag != env.last_built || github.event_name == 'workflow_dispatch'
24+ env :
25+ DOCKERHUB_USERNAME : ${{ secrets.DOCKERHUB_USERNAME }}
26+ DOCKERHUB_TOKEN : ${{ secrets.DOCKERHUB_TOKEN }}
27+ run : |
28+ git clone --branch ${{ env.latest_tag }} https://github.com/Kozea/Radicale.git
29+ echo "${{ env.latest_tag }}" > .last_built_version
30+ echo $DOCKERHUB_TOKEN | docker login -u $DOCKERHUB_USERNAME --password-stdin
31+ docker buildx create --use
32+ docker buildx build \
33+ --platform linux/amd64,linux/arm64 \
34+ --file Radicale/Dockerfile \
35+ --push \
36+ --tag $DOCKERHUB_USERNAME/radicale:${{ env.latest_tag }} \
37+ --tag $DOCKERHUB_USERNAME/radicale:latest \
38+ Radicale
39+
40+ - name : Save built version
41+ if : env.latest_tag != env.last_built
42+ run : |
43+ echo "${{ env.latest_tag }}" > .last_built_version
You can’t perform that action at this time.
0 commit comments