Skip to content

Commit

Permalink
feat(ci): add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Oct 23, 2020
1 parent 6e66713 commit 678d913
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 96 deletions.
70 changes: 12 additions & 58 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,48 +12,25 @@ jobs:
node-version: [10, 12, 14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-node@v1
- name: Setup NodeJS v${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --no-save
- run: npm run build:binary -- node${{ matrix.node-version }}-macos-x64
- uses: rhysd/action-setup-vim@v1
- name: Setup Vim ${{ matrix.vim-version }}
uses: rhysd/action-setup-vim@v1
id: vim
with:
version: ${{ matrix.vim-version }}
neovim: ${{ matrix.neovim }}
- name: Run tests
run: ./scripts/run-vader-tests.sh "${{ steps.vim.outputs.executable }}"

macos_neovim:
name: MacOS Tests (NeoVim)
strategy:
matrix:
os: [macos-latest]
neovim: [true]
vim-version: [v0.2.0, stable]
node-version: [10, 12, 14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --no-save
- run: npm run build:binary -- node${{ matrix.node-version }}-macos-x64
- uses: rhysd/action-setup-vim@v1
id: vim
with:
version: ${{ matrix.vim-version }}
neovim: ${{ matrix.neovim }}
- name: Run tests
run: ./scripts/run-vader-tests.sh "${{ steps.neovim.outputs.executable }}"

linux_vim:
name: Linux Tests (Vim)
strategy:
Expand All @@ -64,48 +41,25 @@ jobs:
node-version: [10, 12, 14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-node@v1
- name: Setup NodeJS v${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --no-save
- run: npm run build:binary -- node${{ matrix.node-version }}-linux-x64
- uses: rhysd/action-setup-vim@v1
- name: Setup Vim ${{ matrix.vim-version }}
uses: rhysd/action-setup-vim@v1
id: vim
with:
version: ${{ matrix.vim-version }}
neovim: ${{ matrix.neovim }}
- name: Run tests
run: ./scripts/run-vader-tests.sh "${{ steps.vim.outputs.executable }}"

linux_neovim:
name: Linux Tests (NeoVim)
strategy:
matrix:
os: [ubuntu-latest]
neovim: [true]
vim-version: [v0.2.0, stable]
node-version: [10, 12, 14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --no-save
- run: npm run build:binary -- node${{ matrix.node-version }}-linux-x64
- uses: rhysd/action-setup-vim@v1
id: vim
with:
version: ${{ matrix.vim-version }}
neovim: ${{ matrix.neovim }}
- name: Run tests
run: ./scripts/run-vader-tests.sh "${{ steps.neovim.outputs.executable }}"

vint:
name: Linter
runs-on: ubuntu-latest
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release
on: release

jobs:
macos:
name: MacOS Release
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --no-save
- run: npm run build:binary -- node${{ matrix.node-version }}-macos-x64 vim-doge-macos
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: ./bin/vim-doge-macos.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
vim-doge-macos
vim-doge-linux
vim-doge-win.exe
*.tar.gz
*.zip
__pycache__/
*.tsbuildinfo

Expand Down
9 changes: 2 additions & 7 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"hooks": {
"before:init": ["npm run format", "npm run lint"],
"after:bump": [
"npm run build:binary",
"echo v${version} > .version && git add .version"
],
"after:release": "rm -f ./bin/vim-doge-*.tar.gz"
"after:bump": ["echo v${version} > .version && git add .version"]
},
"git": {
"commitMessage": "chore(release): v${version} :tada:",
Expand All @@ -17,8 +13,7 @@
},
"github": {
"release": true,
"releaseName": "Release v${version}",
"assets": ["./bin/vim-doge-*.tar.gz"]
"releaseName": "Release v${version}"
},
"plugins": {
"@release-it/conventional-changelog": {
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
"version": "3.3.1",
"description": "A Vim polyglot plugin for generating documentation",
"scripts": {
"prerelease": "./scripts/release.sh",
"release": "release-it",
"release:ci": "release-it --ci",
"release:beta": "npm run prerelease && release-it --preRelease=beta",
"release:beta:ci": "npm run prerelease && release-it --preRelease=beta",
"release:beta": "release-it --preRelease=beta",
"prebuild": "rimraf dist/* && rm -f ./bin/vim-doge && ln -s ../dist/index.js ./bin/vim-doge",
"watch": "npm run prebuild && tsc -p tsconfig.json --watch true --sourceMap",
"build": "tsc -p tsconfig.json",
Expand Down
20 changes: 12 additions & 8 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ set -e
set -u

ROOT_DIR=$(cd "$(dirname "$0")/.."; pwd -P)
TARGET="${1:-}"
BUILD_TARGETS="${1:-}"
OUTFILE="${2:-vim-doge}.tar.gz"

# Build the pkg lib prerequisites if needed.
if [[ ! -d $ROOT_DIR/pkg/lib-es5 ]]; then
Expand All @@ -16,11 +17,14 @@ fi

cd $ROOT_DIR

# Build the binaries.
if [[ "$TARGET" != "" ]]; then
BUILD_TARGETS="$TARGET"
else
BUILD_TARGETS="node14-linux-x64,node14-macos-x64,node14-win-x64"
fi
# Build the binary.
node $ROOT_DIR/pkg/lib-es5/bin.js . -t "$BUILD_TARGETS" --out-path $ROOT_DIR/bin
chmod +x $ROOT_DIR/bin/vim-doge*
chmod +x $ROOT_DIR/bin/vim-doge

# Archive the binary.
cd $ROOT_DIR/bin
rm -f $ROOT_DIR/bin/*.tar.gz
echo "==> Archiving vim-doge -> $OUTFILE"
tar -czf "$OUTFILE" vim-doge

echo "🎉 Done building vim-doge binaries"
19 changes: 0 additions & 19 deletions scripts/release.sh

This file was deleted.

0 comments on commit 678d913

Please sign in to comment.