Skip to content

Merge pull request #1 from sepehr-safari/readme #2

Merge pull request #1 from sepehr-safari/readme

Merge pull request #1 from sepehr-safari/readme #2

name: Deploy Golang Groups Relay
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Clean up previous builds
run: rm -rf ./relay.groups.nip29.com
- name: Install ARM64 Toolchain
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.0' # Use latest Go version
- name: Cache Go Modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build Application
run: CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -buildvcs=false -o relay.groups.nip29.com
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: relay-server
path: relay.groups.nip29.com
deploy:
runs-on: ubuntu-24.04
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: relay-server
- name: Deploy to Server
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: ${{ secrets.SERVER_PORT }}
source: "relay.groups.nip29.com"
target: "/var/www/relays"
- name: Set execute permission
uses: appleboy/ssh-action@v0.1.3
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: chmod +x /var/www/relays/relay.groups.nip29.com
- name: Restart Application
uses: appleboy/ssh-action@v0.1.3
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: sudo systemctl restart relay-groups.service