feat: add cors #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: production deploy | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.19 | |
- name: Install dependencies | |
run: go get . | |
- name: Test with the Go CLI | |
run: go test | |
- name: Build | |
run: go build -o moonlight ./main.go | |
- name: Deploy to server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
sudo systemctl stop hmc-cert-go.service | |
rm -f /home/hmcroot/app/moonlight/moonlight | |
- name: Copy to server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
source: moonlight | |
target: /home/hmcroot/app/moonlight | |
- name: Start service | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: sudo systemctl start hmc-cert-go.service | |
notify: | |
name: Notification | |
runs-on: ubuntu-latest | |
needs: | |
- deploy | |
if: ${{ always() }} # You always want to be notified: success, failure, or cancelled | |
steps: | |
- name: Notify Dev | |
uses: nobrayner/discord-webhook@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
discord-webhook: ${{ secrets.DISCORD_WEBHOOK }} |