Build #146
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
denops_version: | |
description: Denops version | |
required: false | |
default: "v5.0.0" # or "main" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: docker/setup-buildx-action@v1 | |
- uses: docker/login-action@v1 | |
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 '::set-output name=DENOPS_VERSION::v5.0.0' | |
else | |
echo '::set-output name=DENOPS_VERSION::${{ github.event.inputs.denops_version }}' | |
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 |