Skip to content

Commit 1a22ef6

Browse files
committed
Add multi-arch support
1 parent 1e774ad commit 1a22ef6

File tree

4 files changed

+63
-29
lines changed

4 files changed

+63
-29
lines changed

.github/workflows/build.yml

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,77 @@ on:
99
denops_version:
1010
description: Denops version
1111
required: false
12-
default: "main"
1312

1413
jobs:
1514
build:
1615
runs-on: ubuntu-latest
1716
steps:
1817
- uses: actions/checkout@v4
18+
- uses: docker/setup-qemu-action@v3
1919
- uses: docker/setup-buildx-action@v3
2020
- uses: docker/login-action@v3
2121
with:
2222
registry: ghcr.io
2323
username: ${{ github.actor }}
2424
password: ${{ secrets.GITHUB_TOKEN }}
25-
- name: Get DENOPS_VERSION
25+
26+
- name: Construct variables
2627
id: vars
2728
run: |
2829
if [[ -z "${{ github.event.inputs.denops_version }}" ]]; then
2930
echo 'DENOPS_VERSION=main' >> $GITHUB_OUTPUT
3031
else
3132
echo 'DENOPS_VERSION=${{ github.event.inputs.denops_version }}' >> $GITHUB_OUTPUT
3233
fi
33-
shell: bash
34-
35-
- name: Build and Push to ghcr.io
36-
env:
37-
DENOPS_VERSION: ${{ steps.vars.outputs.DENOPS_VERSION }}
38-
shell: bash
39-
run: |
40-
make DENOPS_VERSION=$DENOPS_VERSION build
4134
if [[ $DENOPS_VERSION == v* ]]; then
42-
# Full version string
43-
make DOCKER_TAG=$DENOPS_VERSION push
35+
echo "DOCKER_TAG=$DENOPS_VERSION" >> $GITHUB_OUTPUT
4436
# vX.Y.Z -> vX.Y (major and minor)
45-
export DOCKER_TAG_MINOR=$(echo $DENOPS_VERSION | sed -r 's/(v[0-9]+)(\.[0-9]+)(\.[0-9]+)/\1\2/')
46-
make DOCKER_TAG=$DOCKER_TAG_MINOR push
37+
echo "DOCKER_TAG_MINOR=$(echo $DENOPS_VERSION | sed -r 's/(v[0-9]+)(\.[0-9]+)(\.[0-9]+)/\1\2/')" >> $GITHUB_OUTPUT
4738
# vX.Y.Z -> vX (major only)
48-
export DOCKER_TAG_MAJOR=$(echo $DENOPS_VERSION | sed -r 's/(v[0-9]+)(\.[0-9]+)(\.[0-9]+)/\1/')
49-
make DOCKER_TAG=$DOCKER_TAG_MAJOR push
39+
echo "DOCKER_TAG_MAJOR=$(echo $DENOPS_VERSION | sed -r 's/(v[0-9]+)(\.[0-9]+)(\.[0-9]+)/\1/')" >> $GITHUB_OUTPUT
40+
else
41+
echo "DOCKER_TAG=latest" >> $GITHUB_OUTPUT
42+
echo "DOCKER_TAG_MINOR=latest" >> $GITHUB_OUTPUT
43+
echo "DOCKER_TAG_MAJOR=latest" >> $GITHUB_OUTPUT
5044
fi
51-
make DOCKER_TAG=latest push
45+
shell: bash
46+
47+
- name: Build and push Docker image (Vim)
48+
uses: docker/build-push-action@v6
49+
with:
50+
file: ./dockerfiles/vim
51+
tags:
52+
- ghcr.io/vim-denops/vim:latest
53+
- ghcr.io/vim-denops/vim:${{ steps.vars.outputs.DOCKER_TAG }}
54+
- ghcr.io/vim-denops/vim:${{ steps.vars.outputs.DOCKER_TAG_MINOR }}
55+
- ghcr.io/vim-denops/vim:${{ steps.vars.outputs.DOCKER_TAG_MAJOR }}
56+
cache-from: |
57+
ghcr.io/vim-denops/vim/cache
58+
ghcr.io/vim-denops/vim
59+
cache-to: |
60+
type=registry,ref=ghcr.io/vim-denops/vim/cache,mode=max
61+
context: .
62+
platforms:
63+
- linux/amd64
64+
- linux/arm64
65+
push: true
66+
67+
- name: Build and push Docker image (Neovim)
68+
uses: docker/build-push-action@v6
69+
with:
70+
file: ./dockerfiles/neovim
71+
tags:
72+
- ghcr.io/vim-denops/neovim:latest
73+
- ghcr.io/vim-denops/neovim:${{ steps.vars.outputs.DOCKER_TAG }}
74+
- ghcr.io/vim-denops/neovim:${{ steps.vars.outputs.DOCKER_TAG_MINOR }}
75+
- ghcr.io/vim-denops/neovim:${{ steps.vars.outputs.DOCKER_TAG_MAJOR }}
76+
cache-from: |
77+
ghcr.io/vim-denops/neovim/cache
78+
ghcr.io/vim-denops/neovim
79+
cache-to: |
80+
type=registry,ref=ghcr.io/vim-denops/neovim/cache,mode=max
81+
context: .
82+
platforms:
83+
- linux/amd64
84+
- linux/arm64
85+
push: true

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,33 @@ build: build-vim build-neovim ## Build
1414
build-vim: FORCE ## Build (Vim)
1515
docker buildx build ${BUILD_ARGS} \
1616
--load \
17-
--cache-from=${DOCKER_REGISTRY}/vim/cache \
18-
--cache-from=${DOCKER_REGISTRY}/vim \
19-
--cache-to=type=registry,ref=${DOCKER_REGISTRY}/vim/cache,mode=max \
17+
--cache-from=${DOCKER_REGISTRY}/vim/cache \
18+
--cache-from=${DOCKER_REGISTRY}/vim \
19+
--cache-to=type=registry,ref=${DOCKER_REGISTRY}/vim/cache,mode=max \
2020
--build-arg DENOPS_VERSION=${DENOPS_VERSION} \
21-
-t denops-dockerfile/vim \
22-
-f Dockerfile.vim \
21+
--platform linux/amd64,linux/arm64 \
22+
-t ${DOCKER_REGISTRY}/vim:${DOCKER_TAG} \
23+
-f dockerfiles/vim \
2324
.
2425

2526
build-neovim: FORCE ## Build (Neovim)
2627
docker buildx build ${BUILD_ARGS} \
2728
--load \
28-
--cache-from=${DOCKER_REGISTRY}/neovim/cache \
29-
--cache-from=${DOCKER_REGISTRY}/neovim \
30-
--cache-to=type=registry,ref=${DOCKER_REGISTRY}/neovim/cache,mode=max \
29+
--cache-from=${DOCKER_REGISTRY}/neovim/cache \
30+
--cache-from=${DOCKER_REGISTRY}/neovim \
31+
--cache-to=type=registry,ref=${DOCKER_REGISTRY}/neovim/cache,mode=max \
3132
--build-arg DENOPS_VERSION=${DENOPS_VERSION} \
32-
-t denops-dockerfile/neovim \
33-
-f Dockerfile.neovim \
33+
--platform linux/amd64,linux/arm64 \
34+
-t ${DOCKER_REGISTRY}/neovim:${DOCKER_TAG} \
35+
-f dockerfiles/neovim \
3436
.
3537

3638
push: push-vim push-neovim ## Push
3739

3840
push-vim: FORCE ## Push (Vim)
39-
docker tag denops-dockerfile/vim ${DOCKER_REGISTRY}/vim:${DOCKER_TAG}
4041
docker push ${DOCKER_REGISTRY}/vim:${DOCKER_TAG}
4142

4243
push-neovim: FORCE ## Push (Neovim)
43-
docker tag denops-dockerfile/neovim ${DOCKER_REGISTRY}/neovim:${DOCKER_TAG}
4444
docker push ${DOCKER_REGISTRY}/neovim:${DOCKER_TAG}
4545

4646
FORCE:
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)