Skip to content

feat: support read site version from release tag #143

feat: support read site version from release tag

feat: support read site version from release tag #143

Workflow file for this run

name: custom-deploy-your-server
on:
workflow_dispatch:
push:
branches: [ "main" ]
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: Set up Golang
uses: actions/setup-go@v5
with:
go-version: "1.20"
- name: Install npm dependencies
run: npm ci
working-directory: web/
- name: Run npm build
run: export NODE_ENV=prod && npm run build
working-directory: web/
- name: Check build static
run: ls dist/ -la
working-directory: web/
- name: Get Release version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Update Local Version File
run: echo ${{ steps.get_version.outputs.VERSION }} > .release_version
- name: Install Go modules
run: go mod tidy
- name: Build Go
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o Message-Nest
- name: Copy files to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWD }}
source: "Message-Nest"
target: ${{ secrets.REMOTE_TARGER }}
- name: SSH into server and restart service
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWD }}
script: |
${{ secrets.REMOTE_SCRIPT }}