Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release

on:
push:
branches: [main]

jobs:
release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.event.head_commit.message, 'feat: release v')"
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Lua
uses: leafo/gh-actions-lua@v8

- name: Install Luarocks
uses: leafo/gh-actions-luarocks@v4

- name: Extract release name
id: release_env
shell: bash
env:
MESSAGE: ${{ github.event.head_commit.message }}
run: |
title="${MESSAGE}"
re="^feat: release v*(\S+)"
if [[ $title =~ $re ]]; then
v=v${BASH_REMATCH[1]}
echo "##[set-output name=version;]${v}"
echo "##[set-output name=version_withou_v;]${BASH_REMATCH[1]}"
else
echo "commit format is not correct"
exit 1
fi

- name: Check dot version
shell: bash
run: |
if [ "${{ steps.release_env.outputs.version_withou_v }}" != "$(cat .version)" ]; then
echo "VERSION '${{ steps.release_env.outputs.version_withou_v }}' does not match the dot version file '$(cat .version)'"
exit 1
fi

- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_env.outputs.version_withou_v }}
release_name: ${{ steps.release_env.outputs.version }}
draft: false
prerelease: false

- name: Upload to luarocks
env:
VERSION: ${{ steps.release_env.outputs.version_withou_v }}
APIKEY: ${{ secrets.LUAROCKS_TOKEN }}
run: make upload
1 change: 1 addition & 0 deletions .version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5.3
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ $(target_rock):
[ -n "$$VERSION" ] || { echo VERSION not set; exit 1; }
-@rm -rf /tmp/random_dir_2cs4f0tghRT
mkdir /tmp/random_dir_2cs4f0tghRT
cd /tmp/random_dir_2cs4f0tghRT; git clone https://github.com/kong/lua-resty-aws.git
cd /tmp/random_dir_2cs4f0tghRT; git clone https://github.com/api7/lua-resty-aws.git
cd /tmp/random_dir_2cs4f0tghRT/lua-resty-aws; if [ ! "${VERSION}" = "dev" ]; then git checkout ${VERSION}; fi
cd /tmp/random_dir_2cs4f0tghRT/lua-resty-aws; make dev
cd /tmp/random_dir_2cs4f0tghRT; zip -r lua-resty-aws-${VERSION}-1.src.rock lua-resty-aws
cd /tmp/random_dir_2cs4f0tghRT; cat lua-resty-aws/lua-resty-aws-dev-1.rockspec | sed "s/package_version = \"dev\"/package_version = \"${VERSION}\"/" > lua-resty-aws-${VERSION}-1.rockspec
cd /tmp/random_dir_2cs4f0tghRT; zip -r lua-resty-aws-${VERSION}-1.src.rock lua-resty-aws-${VERSION}-1.rockspec
mv /tmp/random_dir_2cs4f0tghRT/lua-resty-aws-${VERSION}-1.src.rock ./
-@rm lua-resty-aws-${VERSION}-1.rockspec
mv /tmp/random_dir_2cs4f0tghRT/lua-resty-aws-${VERSION}-1.rockspec ./
mv /tmp/random_dir_2cs4f0tghRT/lua-resty-aws-${VERSION}-1.src.rock ./api7-lua-resty-aws-${VERSION}-1.src.rock
-@rm api7-lua-resty-aws-${VERSION}-1.rockspec
mv /tmp/random_dir_2cs4f0tghRT/lua-resty-aws-${VERSION}-1.rockspec ./api7-lua-resty-aws-${VERSION}-1.rockspec


pack: $(target_rock)

Expand Down
10 changes: 5 additions & 5 deletions lua-resty-aws-dev-1.rockspec.template
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
local package_name = "lua-resty-aws"
local package_name = "api7-lua-resty-aws"
local package_version = "dev"
local rockspec_revision = "1"
local github_account_name = "Kong"
local github_repo_name = package_name
local github_account_name = "api7"
local github_repo_name = "lua-resty-aws"
local git_checkout = package_version == "dev" and "main" or package_version

package = package_name
version = package_version .. "-" .. rockspec_revision

source = {
url = "git://github.com/"..github_account_name.."/"..github_repo_name..".git",
branch = git_checkout
tag = git_checkout
}

description = {
Expand All @@ -19,7 +19,7 @@ description = {
AWS SDK generated from the same data as the AWS JavaScript SDK.
]],
license = "Apache 2.0",
homepage = "https://"..github_account_name..".github.io/"..github_repo_name.."/topics/README.md.html"
homepage = "https://github.com/"..github_account_name.."/"..github_repo_name
}

dependencies = {
Expand Down
48 changes: 0 additions & 48 deletions test2.lua

This file was deleted.

4 changes: 2 additions & 2 deletions upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ LR_API_KEY=$2
#LR_API_KEY=INfSIgkuArccxH9zq9M7enqackTiYtgRM6c9l6Y4


ROCK_FILE=lua-resty-aws-$ROCK_VERSION.src.rock
ROCKSPEC_FILE=lua-resty-aws-$ROCK_VERSION.rockspec
ROCK_FILE=api7-lua-resty-aws-$ROCK_VERSION.src.rock
ROCKSPEC_FILE=api7-lua-resty-aws-$ROCK_VERSION.rockspec

if [ "$ROCK_VERSION" == "-1" ]; then
echo "First argument (version) is missing."
Expand Down
Loading