-
Notifications
You must be signed in to change notification settings - Fork 4
85 lines (80 loc) · 2.92 KB
/
build.yml
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
name: Build
on:
push:
branches:
- main
workflow_dispatch:
inputs:
denops_version:
description: Denops version
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Construct variables
id: vars
run: |
if [[ -z "${{ github.event.inputs.denops_version }}" ]]; then
echo 'DENOPS_VERSION=main' >> $GITHUB_OUTPUT
else
echo 'DENOPS_VERSION=${{ github.event.inputs.denops_version }}' >> $GITHUB_OUTPUT
fi
if [[ $DENOPS_VERSION == v* ]]; then
echo "DOCKER_TAG=$DENOPS_VERSION" >> $GITHUB_OUTPUT
# vX.Y.Z -> vX.Y (major and minor)
echo "DOCKER_TAG_MINOR=$(echo $DENOPS_VERSION | sed -r 's/(v[0-9]+)(\.[0-9]+)(\.[0-9]+)/\1\2/')" >> $GITHUB_OUTPUT
# vX.Y.Z -> vX (major only)
echo "DOCKER_TAG_MAJOR=$(echo $DENOPS_VERSION | sed -r 's/(v[0-9]+)(\.[0-9]+)(\.[0-9]+)/\1/')" >> $GITHUB_OUTPUT
else
echo "DOCKER_TAG=latest" >> $GITHUB_OUTPUT
echo "DOCKER_TAG_MINOR=latest" >> $GITHUB_OUTPUT
echo "DOCKER_TAG_MAJOR=latest" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Build and push Docker image (Vim)
uses: docker/build-push-action@v6
with:
file: ./dockerfiles/vim
tags: |
ghcr.io/vim-denops/vim:latest
ghcr.io/vim-denops/vim:${{ steps.vars.outputs.DOCKER_TAG }}
ghcr.io/vim-denops/vim:${{ steps.vars.outputs.DOCKER_TAG_MINOR }}
ghcr.io/vim-denops/vim:${{ steps.vars.outputs.DOCKER_TAG_MAJOR }}
cache-from: |
ghcr.io/vim-denops/vim/cache
ghcr.io/vim-denops/vim
cache-to: |
type=registry,ref=ghcr.io/vim-denops/vim/cache,mode=max
context: .
platforms: |
linux/amd64
linux/arm64
push: true
- name: Build and push Docker image (Neovim)
uses: docker/build-push-action@v6
with:
file: ./dockerfiles/neovim
tags: |
ghcr.io/vim-denops/neovim:latest
ghcr.io/vim-denops/neovim:${{ steps.vars.outputs.DOCKER_TAG }}
ghcr.io/vim-denops/neovim:${{ steps.vars.outputs.DOCKER_TAG_MINOR }}
ghcr.io/vim-denops/neovim:${{ steps.vars.outputs.DOCKER_TAG_MAJOR }}
cache-from: |
ghcr.io/vim-denops/neovim/cache
ghcr.io/vim-denops/neovim
cache-to: |
type=registry,ref=ghcr.io/vim-denops/neovim/cache,mode=max
context: .
platforms: |
linux/amd64
linux/arm64
push: true