2023-01-31 17:27:49 +07:00
|
|
|
name: Auto Publish Website
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
jobs:
|
|
|
|
goreleaser:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-03-22 09:57:30 +07:00
|
|
|
uses: actions/checkout@v3
|
2023-01-31 17:27:49 +07:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: isntall git
|
|
|
|
run: sudo apt install --yes git
|
|
|
|
- name: git global
|
|
|
|
run: sudo git config --global --add safe.directory '*'
|
|
|
|
-
|
|
|
|
name: Fetch all tags
|
|
|
|
run: sudo git fetch --force --tags
|
2023-02-17 12:40:26 +07:00
|
|
|
|
|
|
|
- name: set version
|
|
|
|
run: sudo git tag v99.99.99-alpha
|
|
|
|
|
|
|
|
- name: Set up Go
|
2023-03-22 09:57:30 +07:00
|
|
|
uses: actions/setup-go@v4
|
2023-01-31 17:27:49 +07:00
|
|
|
with:
|
2023-03-02 14:49:35 +07:00
|
|
|
go-version: 'stable'
|
2023-02-17 12:40:26 +07:00
|
|
|
|
|
|
|
- name: Run GoReleaser
|
2023-03-22 09:57:30 +07:00
|
|
|
uses: goreleaser/goreleaser-action@v4
|
2023-01-31 17:27:49 +07:00
|
|
|
with:
|
|
|
|
# either 'goreleaser' (default) or 'goreleaser-pro'
|
|
|
|
distribution: goreleaser
|
2023-07-14 15:45:34 +07:00
|
|
|
version: 1.14.1
|
2023-02-17 12:40:26 +07:00
|
|
|
args: release --rm-dist --snapshot
|
2023-01-31 17:27:49 +07:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
|
|
|
|
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
2023-02-17 12:40:26 +07:00
|
|
|
|
|
|
|
- name: remove migration file
|
|
|
|
run: find . -type f \( -name '*migration*' \) -delete
|
|
|
|
|
2023-01-31 17:27:49 +07:00
|
|
|
- name: install sshpass
|
|
|
|
run: sudo apt install sshpass --yes
|
2023-02-17 12:40:26 +07:00
|
|
|
|
|
|
|
- name: ZeroTier
|
|
|
|
uses: zerotier/github-action@v1.0.1
|
|
|
|
with:
|
|
|
|
network_id: ${{ secrets.ZEROTIER_NETWORK_ID }}
|
|
|
|
auth_token: ${{ secrets.ZEROTIER_CENTRAL_TOKEN }}
|
2023-02-21 15:49:30 +07:00
|
|
|
|
|
|
|
- name: ping host
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
count=10
|
|
|
|
while ! ping -c 1 10.147.18.11 ; do
|
|
|
|
echo "waiting..." ;
|
|
|
|
sleep 1 ;
|
|
|
|
let count=count-1
|
|
|
|
done
|
|
|
|
echo "ping success"
|
2023-02-17 12:40:26 +07:00
|
|
|
|
2023-01-31 17:27:49 +07:00
|
|
|
- name: copy tar to target host
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-02-17 12:40:26 +07:00
|
|
|
sshpass -p "${{ secrets.ssh_password }}" scp -r -o StrictHostKeyChecking=no -P 22 ./dist/*.gz root@10.147.18.11:/var/www/download
|
2023-01-31 17:27:49 +07:00
|
|
|
echo "ping success"
|
|
|
|
- name: send message
|
|
|
|
run: |
|
2023-02-17 12:40:26 +07:00
|
|
|
curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"text","content":{"text":"CasaOS-User updated"}}' ${{ secrets.SSH_ROBOT_URL }}
|