baby's first push prod action: let's hope this works!
This commit is contained in:
parent
01c14b4e38
commit
75f96ddc8c
2 changed files with 45 additions and 9 deletions
45
.forgejo/workflows/push-prod.yaml
Normal file
45
.forgejo/workflows/push-prod.yaml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
EXEC: arimelody-web
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
|
||||
- name: Run tests
|
||||
run: go test -v ./model
|
||||
|
||||
- name: Build binary
|
||||
run: make build
|
||||
|
||||
- name: Bundle tarball
|
||||
run: make bundle
|
||||
|
||||
- name: Set up SSH keys
|
||||
uses: webfactory/ssh-agent@v0.9.0
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
|
||||
- name: Copy to production server
|
||||
run: |
|
||||
mkdir -p ~/.ssh/
|
||||
export REMOTE=${{ secrets.SSH_USER }}@{{ secrets.SSH_HOST }}
|
||||
export PORT=${{ secrets.SSH_PORT }}
|
||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" >
|
||||
scp -P ${{ secrets.SSH_PORT }} ./$EXEC.tar.gz $REMOTE:~/
|
||||
ssh -o StrictHostKeyChecking=no $REMOTE -p $PORT << EOF
|
||||
cd ${{ secrets.DEPLOY_DIR }}
|
||||
tar xzf ~/$EXEC.tar.gz"
|
||||
echo "restart" > ./deploy.sock
|
||||
EOF
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue