mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-04 23:57:54 +00:00
102 lines
3.2 KiB
YAML
102 lines
3.2 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- '_docs/**'
|
|
- '_examples/**'
|
|
- 'README*.md'
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
tag_name: ${{ steps.create_release.outputs.tag_name }}
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: '^1.18'
|
|
- uses: release-drafter/release-drafter@v5
|
|
id: create_release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
build-cli:
|
|
runs-on: ubuntu-latest
|
|
needs: [ release ]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: '^1.18'
|
|
cache: true
|
|
- name: Build
|
|
env:
|
|
VERSION: ${{ needs.release.outputs.tag_name }}
|
|
run: |
|
|
mkdir -p dist/zip
|
|
goos_arr=(windows darwin linux)
|
|
goarch_arr=(386 amd64 arm arm64)
|
|
export CGO_ENABLED=0
|
|
for goos in "${goos_arr[@]}"; do
|
|
for goarch in "${goarch_arr[@]}"; do
|
|
dir="dist/gopeed-$VERSION-$goos-$goarch/"
|
|
(GOOS=$goos GOARCH=$goarch go build -tags nosqlite -ldflags="-s -w" -o $dir github.com/monkeyWie/gopeed/cmd/gopeed \
|
|
&& cd $dir \
|
|
&& zip -r ../zip/gopeed-cli-$VERSION-$goos-$goarch.zip * \
|
|
&& cd ../..) \
|
|
|| true
|
|
done
|
|
done
|
|
- name: Upload
|
|
uses: shogo82148/actions-upload-release-asset@v1
|
|
with:
|
|
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
asset_path: dist/zip/*
|
|
overwrite: true
|
|
build-macos:
|
|
runs-on: macos-latest
|
|
needs: [ release ]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: '^1.18'
|
|
cache: true
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
- uses: subosito/flutter-action@v2
|
|
- name: Install appdmg
|
|
run: npm install -g appdmg
|
|
- name: Build
|
|
env:
|
|
VERSION: ${{ needs.release.outputs.tag_name }}
|
|
run: |
|
|
go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/macos/Frameworks/libgopeed.dylib github.com/monkeyWie/gopeed/bind/desktop
|
|
|
|
cd ui/flutter
|
|
flutter config --enable-macos-desktop
|
|
flutter build macos --release
|
|
cd build/macos/Build/Products/Release
|
|
cat>appdmg.json<<EOF
|
|
{
|
|
"title": "Gopeed",
|
|
"icon": "Gopeed.app/Contents/Resources/AppIcon.icns",
|
|
"contents": [
|
|
{ "x": 448, "y": 344, "type": "link", "path": "/Applications" },
|
|
{ "x": 192, "y": 344, "type": "file", "path": "Gopeed.app" }
|
|
]
|
|
}
|
|
EOF
|
|
mkdir dist
|
|
appdmg appdmg.json dist/Gopeed-$VERSION.dmg
|
|
- name: Upload
|
|
uses: shogo82148/actions-upload-release-asset@v1
|
|
with:
|
|
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
asset_path: ui/flutter/build/macos/Build/Products/Release/dist/*
|
|
overwrite: true |