Skip to content

Commit 7d38ae8

Browse files
committed
now github action would upload assets to qiniu during release
1 parent 05ed250 commit 7d38ae8

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

.github/workflows/release.yaml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
on:
2-
release:
3-
types: [published,edited]
1+
on:
2+
release:
3+
types: [published]
44
env:
55
CGO_ENABLED: 0
6-
76
name: Release qshell
87
jobs:
98
releases-matrix:
@@ -12,6 +11,7 @@ jobs:
1211
env:
1312
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
1413
strategy:
14+
max-parallel: 1
1515
matrix:
1616
include:
1717
# macOS targets
@@ -53,9 +53,16 @@ jobs:
5353
- uses: actions/checkout@v2
5454
- name: Set APP_VERSION env
5555
run: echo ::set-env name=APP_VERSION::$(cat ${GITHUB_EVENT_PATH} | jq -r .release.tag_name )
56-
- name: Environment Printer
57-
uses: managedkaos/print-env@v1.0
58-
56+
- name: Prepare qshell
57+
run: |
58+
set -e
59+
wget -qLO /tmp/qshell-v2.11.0-linux-amd64.tar.gz https://devtools.qiniu.com/qshell-v2.11.0-linux-amd64.tar.gz
60+
tar xf /tmp/qshell-v2.11.0-linux-amd64.tar.gz
61+
rm /tmp/qshell-v2.11.0-linux-amd64.tar.gz
62+
./qshell account -- "$PUBLISH_ACCESS_KEY" "$PUBLISH_SECRET_KEY" default
63+
env:
64+
PUBLISH_ACCESS_KEY: ${{ secrets.PUBLISH_ACCESS_KEY }}
65+
PUBLISH_SECRET_KEY: ${{ secrets.PUBLISH_SECRET_KEY }}
5966
- uses: wangyoucao577/go-release-action@master
6067
with:
6168
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -64,3 +71,15 @@ jobs:
6471
goversion: "https://golang.org/dl/go1.20.1.linux-amd64.tar.gz"
6572
ldflags: -X "github.com/qiniu/qshell/v2/iqshell/common/version.version=${{ env.APP_VERSION }}" -extldflags "-static"
6673
project_path: "./main"
74+
retry: '100'
75+
- name: Upload Release Asset to Qiniu
76+
run: |
77+
set -e
78+
cd ./main/build-artifacts-*
79+
FILENAME="qshell-${{ env.APP_VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz"
80+
if [ "${{ matrix.goos }}" = "windows" ]; then
81+
FILENAME="qshell-${{ env.APP_VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}.zip"
82+
fi
83+
../../qshell rput --resumable-api-v2 --overwrite "$PUBLISH_BUCKET_NAME" "$FILENAME" "$FILENAME"
84+
env:
85+
PUBLISH_BUCKET_NAME: ${{ secrets.PUBLISH_BUCKET_NAME }}

0 commit comments

Comments
 (0)