Skip to content

Fix GHA

Fix GHA #152

Workflow file for this run

name: Build
on:
push:
branches:
- main
workflow_dispatch:
inputs:
denops_version:
description: Denops version
required: false
default: "main"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get DENOPS_VERSION
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
shell: bash
- name: Build and Push to ghcr.io
env:
DENOPS_VERSION: ${{ steps.vars.outputs.DENOPS_VERSION }}
shell: bash
run: |
make DENOPS_VERSION=$DENOPS_VERSION build
if [[ $DENOPS_VERSION == v* ]]; then
# Full version string
make DOCKER_TAG=$DENOPS_VERSION push
# vX.Y.Z -> vX.Y (major and minor)
export DOCKER_TAG_MINOR=$(echo $DENOPS_VERSION | sed -r 's/(v[0-9]+)(\.[0-9]+)(\.[0-9]+)/\1\2/')
make DOCKER_TAG=$DOCKER_TAG_MINOR push
# vX.Y.Z -> vX (major only)
export DOCKER_TAG_MAJOR=$(echo $DENOPS_VERSION | sed -r 's/(v[0-9]+)(\.[0-9]+)(\.[0-9]+)/\1/')
make DOCKER_TAG=$DOCKER_TAG_MAJOR push
fi
make DOCKER_TAG=latest push