Skip to content

add deploying

add deploying #30

Workflow file for this run

name: Build and Release csdmpro
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
build:
name: Build csdmpro
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.24"
- name: Install dependencies
run: go mod tidy
- name: Install Wire
run: go install github.com/google/wire/cmd/wire@latest
- name: Build project with Make
run: make
- name: Create release tarball
run: tar -czvf csdmpro.tar.gz csdmpro
- name: Upload tarball as artifact
uses: actions/upload-artifact@v4
with:
name: csdmpro-release
path: csdmpro.tar.gz
release:
name: Release csdmpro
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: csdmpro-release
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
files: csdmpro.tar.gz
deploy:
name: Deploy csdmpro
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: csdmpro-release
- name: Checkout code
uses: actions/checkout@v3
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan cs.thekhanj.ir >> ~/.ssh/known_hosts
- name: Deploy using custom script
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
TAG: ${{ github.ref_name }}
run: ./ci/deploy