Skip to content

Commit ee1e3ab

Browse files
authored
Merge pull request #850 from numToStr/feat/ci
feat(ci): publish platform specific binaries
2 parents ab90988 + cb839c5 commit ee1e3ab

File tree

4 files changed

+119
-50
lines changed

4 files changed

+119
-50
lines changed

.github/workflows/build.yml

Lines changed: 117 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,123 @@
11
name: build
2-
on: push
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- "*"
9+
pull_request:
10+
branches:
11+
- master
12+
13+
env:
14+
PROJECT: lua-language-server
15+
BIN_DIR: bin
16+
317
jobs:
418
compile:
5-
runs-on: ${{ matrix.os }}
619
strategy:
7-
fail-fast: false
820
matrix:
9-
os: [windows-latest, ubuntu-18.04, macos-latest]
21+
job:
22+
- { os: ubuntu-latest, target: linux }
23+
- { os: macos-latest, target: darwin }
24+
- { os: windows-latest, target: windows }
25+
runs-on: ${{ matrix.job.os }}
1026
steps:
11-
- uses: actions/checkout@v1
12-
with:
13-
ref: refs/heads/master
14-
submodules : recursive
15-
- uses: actboy168/setup-luamake@master
16-
- run: luamake
17-
- uses: actions/upload-artifact@v2
18-
with:
19-
name: lua-language-server
20-
path: |
21-
changelog.md
22-
bin
23-
resource:
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v1
27-
with:
28-
ref: refs/heads/master
29-
submodules : recursive
30-
- uses: actions/upload-artifact@v2
31-
with:
32-
name: lua-language-server
33-
path: |
34-
main.lua
35-
debugger.lua
36-
locale
37-
meta
38-
script
27+
- uses: actions/checkout@v2
28+
with:
29+
submodules: recursive
30+
31+
- name: Setting up workflow variables
32+
id: vars
33+
shell: bash
34+
run: |
35+
# Package version
36+
if [[ $GITHUB_REF = refs/tags/* ]]; then
37+
PKG_VERSION=${GITHUB_REF##*/}
38+
else
39+
PKG_VERSION=${GITHUB_SHA:0:7}
40+
fi
41+
42+
# Package suffix relative to the platform
43+
if [[ "${{ matrix.job.target }}" = windows ]]; then
44+
PKG_SUFFIX="zip"
45+
else
46+
PKG_SUFFIX="tar.gz"
47+
fi
48+
49+
# Package name w/ version
50+
PKG_BASENAME="${{ env.PROJECT }}-${PKG_VERSION}-${{ matrix.job.target }}"
51+
52+
# Full name of the tarball asset
53+
PKG_NAME="${PKG_BASENAME}.${PKG_SUFFIX}"
54+
55+
# Staging area for tarballs
56+
PKG_STAGING="ci_staging/$PKG_BASENAME"
57+
58+
echo ::set-output name=PKG_VERSION::${PKG_VERSION}
59+
echo ::set-output name=PKG_BASENAME::${PKG_BASENAME}
60+
echo ::set-output name=PKG_NAME::${PKG_NAME}
61+
echo ::set-output name=PKG_PATH::"${PKG_STAGING}/${PKG_NAME}"
62+
echo ::set-output name=PKG_STAGING::${PKG_STAGING}
63+
64+
- uses: actboy168/setup-luamake@master
65+
66+
- run: luamake
67+
68+
- uses: actions/upload-artifact@v2
69+
with:
70+
name: ${{ steps.vars.outputs.PKG_BASENAME }}
71+
path: |
72+
${{ env.BIN_DIR }}
73+
main.lua
74+
debugger.lua
75+
LICENSE
76+
changelog.md
77+
locale
78+
meta
79+
script
80+
81+
- name: Package tarballs
82+
if: startsWith(github.ref, 'refs/tags/')
83+
shell: bash
84+
run: |
85+
STAGING=${{ steps.vars.outputs.PKG_STAGING }}
86+
NAME=${{ steps.vars.outputs.PKG_NAME }}
87+
88+
# Making the staging area
89+
mkdir -p ${STAGING}
90+
91+
# Copying binary and runtime files to staging area
92+
cp -r main.lua debugger.lua LICENSE changelog.md locale meta script ${{ env.BIN_DIR }} ${STAGING}
93+
94+
# Creating release assets
95+
pushd "${STAGING}/" >/dev/null
96+
if [[ "${{ matrix.job.target }}" = windows ]]; then
97+
7z -y a ${NAME} * | tail -2
98+
else
99+
tar czf ${NAME} *
100+
fi
101+
popd >/dev/null
102+
103+
# Packaging submodules for homebrew distribution
104+
- name: Package submodules
105+
id: submodules
106+
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.job.target == 'darwin' }}
107+
run: |
108+
STAGING=${{ steps.vars.outputs.PKG_STAGING }}
109+
PKG_SUBMOD_NAME="${{ env.PROJECT }}-${{ steps.vars.outputs.PKG_VERSION }}-submodules.zip"
110+
PKG_SUBMOD_PATH="${STAGING}/$PKG_SUBMOD_NAME"
111+
112+
zip -r $PKG_SUBMOD_PATH ./ -x "*.git*" -x "*.vscode*" -x "build*" -x "${{ env.BIN_DIR }}*" -x "${STAGING}*"
113+
114+
echo ::set-output name=PKG_SUBMOD_PATH::${PKG_SUBMOD_PATH}
115+
116+
- name: Publish release assets
117+
uses: softprops/action-gh-release@v1
118+
if: startsWith(github.ref, 'refs/tags/')
119+
with:
120+
generate_release_notes: true
121+
files: |
122+
${{ steps.vars.outputs.PKG_PATH }}
123+
${{ steps.submodules.outputs.PKG_SUBMOD_PATH }}

.github/workflows/checkPR.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

3rd/bee.lua

3rd/lovr-api

0 commit comments

Comments
 (0)