ci: auto release

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
main^2
Jianhui Zhao 2021-02-27 00:29:53 +08:00
parent 9166d3ab80
commit 93b0e7e3c5
1 changed files with 45 additions and 0 deletions

45
.github/workflows/release.yml vendored 100644
View File

@ -0,0 +1,45 @@
name: release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-20.04
steps:
- id: changelog
uses: zhaojh329/auto-changelog@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
body: ${{steps.changelog.outputs.changelog}}
- uses: actions/checkout@v2
with:
submodules: true
- id: get-version
uses: battila7/get-version-action@v2
- id: release-asset
run: |
version=${{ steps.get-version.outputs.version-without-v }}
cd ..
cp -r libuhttpd libuhttpd-$version
rm -rf libuhttpd-$version/.git* libuhttpd-$version/src/buffer/.git* libuhttpd-$version/src/http-parser/{.git*,.mailmap,.travis.yml}
tar zcfv libuhttpd-$version.tar.gz libuhttpd-$version
echo "::set-output name=asset-path::../libuhttpd-$version.tar.gz"
echo "::set-output name=asset-name::libuhttpd-$version.tar.gz"
- id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ${{ steps.release-asset.outputs.asset-path }}
asset_name: ${{ steps.release-asset.outputs.asset-name }}
asset_content_type: application/gzip