Skip to content

Commit

Permalink
Merge pull request #2 from Nebula-DEX/deployment-pipeline
Browse files Browse the repository at this point in the history
feat: add deployment pipeline
  • Loading branch information
ehh-why-its-so-hard authored Oct 24, 2024
2 parents b785c07 + bb3fb43 commit 29ba1c3
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/deploy-nebula.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
name: Deploy binaries

"on":
push:
tags:
- "v*"

jobs:
build_dist:
name: "Build binary"
runs-on: ubuntu-latest
permissions:
contents: write
env:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0

steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'

- name: Check out code
uses: actions/checkout@v2
with:
ref: ${{ inputs.tag }}

- name: Build binary
run: go build -o dist/candles-api ./main.go

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: candles_api_dist
path: ./dist

publish_dist:
name: 'Publis candles-api'
needs: build_dist
runs-on: ubuntu-latest
strategy:
matrix:
target: ${{ fromJSON( vars.JSON_CANDLES_API_SERVERS) }}
steps:
- name: Download built dist
uses: actions/download-artifact@v4
with:
name: candles_api_dist
path: ./
- name: 'Publish binary'
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.CANDLES_APIDEPLOYEMENT_SSH_KEY }}
ARGS: "--archive --compress --verbose --checksum --delete -i --rsync-path='sudo rsync'"
SOURCE: 'dist/candles-api'
REMOTE_HOST: '${{ matrix.target }}'
REMOTE_USER: 'candles-api-deploymen'
TARGET: '/usr/local/bin/candles-api'
# EXCLUDE: "/dist/, /node_modules/"
# SCRIPT_BEFORE: |
# whoami
SCRIPT_AFTER: |
whoami
systemctl restart candles-api

0 comments on commit 29ba1c3

Please sign in to comment.