feat: Create Neogen semver
This commit is contained in:
28
.github/workflows/semver.yml
vendored
Normal file
28
.github/workflows/semver.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Generates Neogen tag
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
gen_tag:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
version:
|
||||
- nightly
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Neovim
|
||||
uses: rhysd/action-setup-vim@v1
|
||||
id: neovim
|
||||
with:
|
||||
neovim: true
|
||||
version: ${{ matrix.version }}
|
||||
- uses: actions/checkout@v1 # related: actions/checkout#290
|
||||
- name: Run tag_gen
|
||||
run: make tag
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
3
Makefile
3
Makefile
@@ -1,2 +1,5 @@
|
||||
documentation:
|
||||
nvim --headless --noplugin -u ./scripts/minimal_init.vim -c "lua MiniDoc.generate()" -c "qa!"
|
||||
|
||||
tag:
|
||||
./scripts/generate_tag.sh
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
---@toc_entry Neogen's purpose
|
||||
-- Requires ===================================================================
|
||||
local neogen = {}
|
||||
neogen.version = "1.0.0"
|
||||
|
||||
local conf
|
||||
local config = require("neogen.config")
|
||||
|
||||
33
scripts/generate_tag.sh
Executable file
33
scripts/generate_tag.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Copied from https://github.com/nvim-neorg/neorg/blob/main/scripts/generate_tag.sh
|
||||
|
||||
current_version=$(nvim --headless --noplugin -u ./scripts/minimal_init.vim -c 'luafile ./scripts/get_version.lua' -c 'qa' 2>&1 | tr -d \")
|
||||
|
||||
# get current commit hash for tag
|
||||
commit=$(git rev-parse HEAD)
|
||||
|
||||
# Creates a new tag for current version
|
||||
push_tag() {
|
||||
|
||||
curl -s -X POST https://api.github.com/repos/danymat/neogen/git/refs \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-d @- << EOF
|
||||
{
|
||||
"ref": "refs/tags/$current_version",
|
||||
"sha": "$commit"
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "Generated new tag: $current_version"
|
||||
}
|
||||
|
||||
echo "Current version: $current_version"
|
||||
echo "Last commit: $commit"
|
||||
echo "Existing tags: $(git tag -l)"
|
||||
|
||||
if [ $(git tag -l "$current_version") ]; then
|
||||
echo "No new Neogen version (current: $current_version)"
|
||||
exit 0
|
||||
else
|
||||
push_tag
|
||||
fi
|
||||
1
scripts/get_version.lua
Normal file
1
scripts/get_version.lua
Normal file
@@ -0,0 +1 @@
|
||||
print(require('neogen').version)
|
||||
Reference in New Issue
Block a user