Skip to content

Commit 55e57a8

Browse files
authored
feat: add github actions for release (#117)
1 parent 5cc4d44 commit 55e57a8

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Install Lua
17+
uses: leafo/gh-actions-lua@v8
18+
19+
- name: Install Luarocks
20+
uses: leafo/gh-actions-luarocks@v4
21+
22+
- name: Extract tag name
23+
id: tag_env
24+
shell: bash
25+
run: echo "##[set-output name=version;]$(echo ${GITHUB_REF##*/})"
26+
27+
# use ${tag:1} to filter out the heading "v" of "v1.0"
28+
- name: Upload to luarocks
29+
env:
30+
LUAROCKS_TOKEN: ${{ secrets.LUAROCKS_TOKEN }}
31+
run: |
32+
luarocks install dkjson
33+
tag=${{ steps.tag_env.outputs.version }}
34+
luarocks upload rockspec/lua-resty-etcd-${tag:1}-0.rockspec --api-key=${LUAROCKS_TOKEN}
35+
36+
- name: Create Release
37+
id: create_release
38+
uses: actions/create-release@v1
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
tag_name: ${{ steps.tag_env.outputs.version }}
43+
release_name: ${{ steps.tag_env.outputs.version }}
44+
draft: false
45+
prerelease: false

MAINTAINING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Version Publish
2+
3+
After [#117](https://github.com/api7/lua-resty-etcd/pull/117) got merged, we could publish new version of lua-resty-etcd easily. All you need to do is:
4+
5+
- Create a PR that add the rockspec for the new version.
6+
- Create a tag with format like 'v1.0'.
7+
8+
The tag would trigger Github Actions to upload to both luarocks and github release.

0 commit comments

Comments
 (0)