forked from Orcpub/orcpub
-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (114 loc) · 4.89 KB
/
docker.yaml
File metadata and controls
127 lines (114 loc) · 4.89 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
123
124
125
126
127
name: Docker Releases
# 1️⃣ Trigger on tag pushes and manual dispatches
on:
push:
tags:
- '*' # e.g. 1.0, 2.3.4.4
workflow_dispatch:
inputs:
tag:
description: "Tag name to build (e.g., 1.2.3.4)"
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
VERSION="${{ github.event.inputs.tag }}"
else
VERSION="${GITHUB_REF#refs/tags/}"
fi
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
# --------------------------------------------------------------------
# Checkout the repo (HTTPS – no SSH key needed)
# --------------------------------------------------------------------
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.tag && format('refs/tags/{0}', github.event.inputs.tag) || github.ref }}
# --------------------------------------------------------------------
# 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.VERSION }}"/' 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/Dockerfile
target: app
platforms: linux/amd64
push: true
tags: orcpub/orcpub:latest
# --------------------------------------------------------------------
# Build & push the versioned image for orcpub
# --------------------------------------------------------------------
- name: Build and push ${{ steps.get_version.outputs.VERSION }} orcpub
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/Dockerfile
target: app
platforms: linux/amd64
push: true
tags: orcpub/orcpub:release-${{ steps.get_version.outputs.VERSION }}
# --------------------------------------------------------------------
# Build & push the “latest” image for datomic
# --------------------------------------------------------------------
- name: Build and push latest datomic
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/Dockerfile
target: transactor
platforms: linux/amd64
push: true
tags: orcpub/datomic:latest
# --------------------------------------------------------------------
# Build & push the versioned image for datomic
# --------------------------------------------------------------------
- name: Build and push ${{ steps.get_version.outputs.VERSION }} datomic
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/Dockerfile
target: transactor
platforms: linux/amd64
push: true
tags: orcpub/datomic:release-${{ steps.get_version.outputs.VERSION }}
# --------------------------------------------------------------------
# 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.VERSION }}"
git push