oopsie/.gitea/workflows/build-and-copy.yaml

26 lines
934 B
YAML
Raw Normal View History

2024-05-05 19:42:07 +01:00
name: Build and copy to prod
on:
push:
jobs:
build-and-copy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Build binary
2024-05-05 19:50:45 +01:00
run: go build -o dist/oopsie
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
2024-05-05 19:50:51 +01:00
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
2024-05-05 20:43:25 +01:00
- name: Stop the service
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} -o RemoteCommand="systemctl --user stop oopsie_service.service"
2024-05-05 19:50:51 +01:00
- name: Copy to prod
2024-05-05 20:35:02 +01:00
run: scp -rp dist/* ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:oopsie/
- name: Restart the service
2024-05-05 20:43:25 +01:00
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} -o RemoteCommand="systemctl --user start oopsie_service.service"