Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaojh329 committed May 21, 2021
1 parent 51adecf commit 03d8a9d
Showing 1 changed file with 34 additions and 46 deletions.
80 changes: 34 additions & 46 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,55 @@
name: release

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-20.04
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}

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}}
release-asset:
runs-on: ubuntu-20.04
needs: release
strategy:
matrix:
target: [ linux.amd64, linux.arm64, darwin.amd64, windows.amd64 ]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- id: get-version
uses: battila7/get-version-action@v2
- uses: actions/setup-go@v2
with:
go-version: 1.16.0
go-version: 1.16.4

- uses: actions/setup-node@v2
with:
node-version: '12'
- id: release-asset
env:
target: ${{ matrix.target }}

- uses: battila7/get-version-action@v2

- uses: actions/checkout@v2

- id: build
run: |
cd frontend
npm install
npm run build
cd ..
version=${{ steps.get-version.outputs.version-without-v }}
os=$(echo $target | awk -F. '{print $1}')
arch=$(echo $target | awk -F. '{print $2}')
./build.sh $os $arch
mv rttys-$os-$arch rttys-$os-$arch-$version
tar zcf rttys-$os-$arch-$version.tar.gz rttys-$os-$arch-$version
echo "::set-output name=asset-path::./rttys-$os-$arch-$version.tar.gz"
echo "::set-output name=asset-name::rttys-$os-$arch-$version.tar.gz"
- id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
./build.sh linux amd64
mv rttys-linux-amd64 rttys-linux-amd64-$version
tar zcf rttys-linux-amd64-$version.tar.gz rttys-linux-amd64-$version
./build.sh linux arm64
mv rttys-linux-arm64 rttys-linux-arm64-$version
tar zcf rttys-linux-arm64-$version.tar.gz rttys-linux-arm64-$version
./build.sh darwin amd64
mv rttys-darwin-amd64 rttys-darwin-amd64-$version
tar zcf rttys-darwin-amd64-$version.tar.gz rttys-darwin-amd64-$version
./build.sh windows amd64
mv rttys-windows-amd64 rttys-windows-amd64-$version
tar zcf rttys-windows-amd64-$version.tar.gz rttys-windows-amd64-$version
- uses: marvinpinto/action-automatic-releases@latest
with:
upload_url: ${{ needs.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
repo_token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: false
files: rttys-*.tar.gz

0 comments on commit 03d8a9d

Please sign in to comment.