-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
73 lines (62 loc) · 2.09 KB
/
Copy pathdockerimage.yml
File metadata and controls
73 lines (62 loc) · 2.09 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
name: Release Docker Image
on:
push:
branches:
- master
tags:
- '*-alpha*'
- '*-beta*'
- '*-rc*'
# ref https://docs.github.com/zh/actions/learn-github-actions/variables
env:
package_json: "app/package.json"
docker_hub_owner: "b3log"
docker_hub_repo: "siyuan"
jobs:
build:
if: ${{ github.repository_owner == 'siyuan-note' }}
name: build
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v6
with:
ref: ${{ github.event.ref }}
submodules: recursive
- name: Extract version from package.json
id: version
run: |
echo "value=$(jq .version ${{ env.package_json }} -r)" >> $GITHUB_OUTPUT
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v4
- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PWD }}
- name: Build and push Docker image
run: |
LATEST_FLAG=""
if [ "${{ github.ref }}" = "refs/heads/master" ]; then
LATEST_FLAG="-t ${{ env.docker_hub_owner }}/${{ env.docker_hub_repo }}:latest"
fi
docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 $LATEST_FLAG -t ${{ env.docker_hub_owner }}/${{ env.docker_hub_repo }}:v${{ steps.version.outputs.value }} .