Skip to content

Commit 06e7542

Browse files
committed
ci: add publish job
1 parent 8b3c602 commit 06e7542

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: CI
33
on:
44
push:
55
branches: [main]
6+
tags:
7+
- '[0-1].[0-9]+.[0-9]+-[0-9]'
68
pull_request:
79
branches: [main]
810

@@ -79,3 +81,50 @@ jobs:
7981
luarocks_versions: 5.1.5:3.8.0
8082
- name: Build
8183
run: luarocks make --no-install rockspecs/lua-evdev-dev-1.rockspec
84+
85+
publish:
86+
name: publish
87+
runs-on: ubuntu-20.04
88+
if: github.event_name == 'push'
89+
needs:
90+
- lint
91+
- format
92+
- build
93+
steps:
94+
- name: Checkout
95+
uses: actions/checkout@v2
96+
- name: Get Version
97+
id: lua-evdev-version
98+
run: |
99+
if test "${GITHUB_REF_TYPE}" = "tag"; then
100+
echo "::set-output name=value::${GITHUB_REF_NAME}"
101+
else
102+
echo "::set-output name=value::dev-1"
103+
fi
104+
- name: Get Cache Key
105+
id: luver-cache-key
106+
env:
107+
CI_RUNNER_OS: ${{ runner.os }}
108+
CI_SECRETS_CACHE_VERSION: ${{ secrets.CACHE_VERSION }}
109+
run: |
110+
echo "::set-output name=value::${CI_RUNNER_OS}-luver-${CI_SECRETS_CACHE_VERSION}-publish-$(date -u +%Y-%m-%d)"
111+
shell: bash
112+
- name: Setup Cache
113+
uses: actions/cache@v2
114+
with:
115+
path: ~/.local/share/luver
116+
key: ${{ steps.luver-cache-key.outputs.value }}
117+
- name: Setup Lua
118+
uses: MunifTanjim/luver-action@v1
119+
with:
120+
default: 5.1.5
121+
lua_versions: 5.1.5
122+
luajit_versions: 5.1.5:2.1.0-git
123+
luarocks_versions: 5.1.5:3.8.0
124+
- name: Publish
125+
env:
126+
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
127+
LUA_EVDEV_VERSION: ${{ steps.lua-evdev-version.outputs.value }}
128+
run: |
129+
luarocks install lua-cjson
130+
./scripts/publish.sh ${LUA_EVDEV_VERSION} --force

0 commit comments

Comments
 (0)