Skip to content

Commit 9209c47

Browse files
authored
Create push_test_server.yml
Signed-off-by: link <[email protected]>
1 parent a2fcd5f commit 9209c47

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Auto Publish Website
2+
on:
3+
push:
4+
branches:
5+
- main
6+
permissions:
7+
contents: write
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-22.04
11+
steps:
12+
-
13+
name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
- name: isntall git
18+
run: sudo apt install --yes git
19+
- name: git global
20+
run: sudo git config --global --add safe.directory '*'
21+
-
22+
name: Fetch all tags
23+
run: sudo git fetch --force --tags
24+
- name: Get version
25+
id: get_version
26+
# run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
27+
run: echo "VERSION=$(git describe --abbrev=0 --tags | awk -F- '{print $1}')" >> $GITHUB_ENV
28+
- name: show version
29+
id: show_version
30+
# run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
31+
run: echo ${{env.VERSION}}
32+
-
33+
name: Set up Go
34+
uses: actions/setup-go@v2
35+
with:
36+
go-version: 1.19
37+
-
38+
name: Run GoReleaser
39+
uses: goreleaser/goreleaser-action@v2
40+
with:
41+
# either 'goreleaser' (default) or 'goreleaser-pro'
42+
distribution: goreleaser
43+
version: latest
44+
args: release --rm-dist
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
48+
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
49+
- name: install sshpass
50+
run: sudo apt install sshpass --yes
51+
- name: copy tar to target host
52+
shell: bash
53+
run: |
54+
sshpass -p "${{ secrets.ssh_password }}" scp -r -o StrictHostKeyChecking=no -P ${{ secrets.ssh_port }} ./dist/*.gz root@${{ secrets.ssh_ip }}:/var/www/download
55+
echo "ping success"
56+
- name: send message
57+
run: |
58+
curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"text","content":{"text":"CasaOS-Gateway updated"}}' https://open.feishu.cn/open-apis/bot/v2/hook/eb8f45c7-9636-4b64-84f2-a66d9aeb9d30

0 commit comments

Comments
 (0)