forked from Orcpub/orcpub
-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (109 loc) · 4.75 KB
/
Copy pathdocker.yaml
File metadata and controls
122 lines (109 loc) · 4.75 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
122
name: Docker Releases
# 1️⃣ Trigger on tag pushes and manual dispatches
on:
push:
tags:
- 'v*' # e.g. v1.0, v2.3.4
workflow_dispatch:
inputs:
tag:
description: "Tag name to build (e.g., v1.2.3)"
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
# --------------------------------------------------------------------
# Get the version string – works for both push and dispatch
# --------------------------------------------------------------------
- name: Get Version
id: get_version
run: |
if [[ -n "${{ github.event.inputs.tag }}" ]]; then
ref="${{ github.event.inputs.tag }}"
else
ref="${GITHUB_REF}"
fi
echo "VERSION1=${ref#refs/*/}" >> $GITHUB_OUTPUT
echo "VERSION2=${ref#refs/*/v}" >> $GITHUB_OUTPUT
# --------------------------------------------------------------------
# Checkout the repo (HTTPS – no SSH key needed)
# --------------------------------------------------------------------
- name: Checkout
uses: actions/checkout@v3
# --------------------------------------------------------------------
# Update version/date in src/cljs/orcpub/ver.cljc
# --------------------------------------------------------------------
- name: Update src/cljs/orcpub/ver.cljc
run: |
sed -i 's/defn version \[\] ".*"/defn version [] "${{ steps.get_version.outputs.VERSION1 }}"/' src/cljs/orcpub/ver.cljc
sed -i 's/defn date \[\] ".*"/defn date [] "$(date +%m-%d-%Y)"/' src/cljs/orcpub/ver.cljc
cat src/cljs/orcpub/ver.cljc
# --------------------------------------------------------------------
# Docker: login, QEMU, Buildx
# --------------------------------------------------------------------
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# --------------------------------------------------------------------
# Build & push the “latest” image for orcpub
# --------------------------------------------------------------------
- name: Build and push latest orcpub
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/orcpub/Dockerfile
platforms: linux/amd64
push: true
tags: orcpub/orcpub:latest
# --------------------------------------------------------------------
# Build & push the versioned image for orcpub
# --------------------------------------------------------------------
- name: Build and push ${{ steps.get_version.outputs.VERSION2 }} orcpub
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/orcpub/Dockerfile
platforms: linux/amd64
push: true
tags: orcpub/orcpub:release-${{ steps.get_version.outputs.VERSION2 }}
# --------------------------------------------------------------------
# Build & push the “latest” image for datomic
# --------------------------------------------------------------------
- name: Build and push latest datomic
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/datomic/Dockerfile
platforms: linux/amd64
push: true
tags: orcpub/datomic:latest
# --------------------------------------------------------------------
# Build & push the versioned image for datomic
# --------------------------------------------------------------------
- name: Build and push ${{ steps.get_version.outputs.VERSION2 }} datomic
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/datomic/Dockerfile
platforms: linux/amd64
push: true
tags: orcpub/datomic:release-${{ steps.get_version.outputs.VERSION2 }}
# --------------------------------------------------------------------
# Commit the updated version file back to *develop*
# --------------------------------------------------------------------
- name: Commit updated ver.cljc
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git fetch --all
git checkout develop || git checkout -b develop
git add src/cljs/orcpub/ver.cljc
git commit -m "Update version to ${{ steps.get_version.outputs.VERSION1 }}"
git push