Skip to content

Build

Build #176

Workflow file for this run

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
DENOPS_VERSION=main
else
DENOPS_VERSION=${{ github.event.inputs.denops_version }}
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