-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·51 lines (50 loc) · 1.89 KB
/
master.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Release
on:
push:
branches:
- master
jobs:
release:
runs-on: ubuntu-latest
if: startsWith(github.event.commits[0].message, 'release')
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: '0'
- name: Set env vars
id: set_env
run: |
VERSION=$(cat snwDistance.toc | gawk '/## Version: /' | grep -Eo "(v[0-9]+\.[0-9]+\.[0-9]+)")
RELEASEBODY=$(awk -v RS='### Version ' '/'$VERSION':(.*)/ {print $0}' CHANGELOG.md)
RELEASEBODY="${RELEASEBODY//'%'/'%25'}"
RELEASEBODY="${RELEASEBODY//$'\n'/'%0A'}"
RELEASEBODY="${RELEASEBODY//$'\r'/'%0D'}"
echo "::set-output name=version::${VERSION}"
echo "::set-output name=RELEASEBODY::${RELEASEBODY}"
- name: Build
run: |
rsync -av --exclude='*.git*' --exclude='.github' --exclude='CHANGELOG.md' --exclude='README.md' . ./snwDistance
zip -r snwDistance-${{ steps.set_env.outputs.version }}.zip ./snwDistance
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.set_env.outputs.version }}
release_name: snwDistance-${{ steps.set_env.outputs.version }}
body: |
${{ steps.set_env.outputs.RELEASEBODY }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./snwDistance-${{ steps.set_env.outputs.version }}.zip
asset_name: snwDistance-${{ steps.set_env.outputs.version }}.zip
asset_content_type: application/zip