Skip to content

feat: release v2.0.1 (#6) #8

feat: release v2.0.1 (#6)

feat: release v2.0.1 (#6) #8

Workflow file for this run

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