-
Notifications
You must be signed in to change notification settings - Fork 4
59 lines (49 loc) · 1.69 KB
/
Build Image.yml
File metadata and controls
59 lines (49 loc) · 1.69 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
name: Build Docker Image
on:
push:
branches:
- main
- master
tags:
- 'v*'
workflow_dispatch:
jobs:
buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set tags
id: set-tags
run: |
GITBOOK_VER=$(npm view gitbook-cli version 2>/dev/null || echo "0.0.0")
HONKIT_VER=$(npm view honkit version 2>/dev/null || echo "0.0.0")
H_MAJOR=$(echo "$HONKIT_VER" | cut -d. -f1)
H_MINOR=$(echo "$HONKIT_VER" | cut -d. -f2)
TAGS="bloodstar/gitbook-builder:latest"
TAGS="$TAGS,bloodstar/gitbook-builder:gitbook-$GITBOOK_VER"
TAGS="$TAGS,bloodstar/gitbook-builder:honkit-$H_MAJOR"
TAGS="$TAGS,bloodstar/gitbook-builder:honkit-$H_MAJOR.$H_MINOR"
TAGS="$TAGS,bloodstar/gitbook-builder:honkit-$HONKIT_VER"
# git tag push 时追加 v<semver>
GIT_TAG=${GITHUB_REF#refs/tags/}
if [ "$GIT_TAG" != "$GITHUB_REF" ]; then
TAGS="$TAGS,bloodstar/gitbook-builder:$GIT_TAG"
fi
echo "tags=$TAGS" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v7
with:
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: ${{ steps.set-tags.outputs.tags }}