airflow: Add software migratino workflow #36
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
# This workflow performs continuous delivery (CD) to CM servers. | |
# This workflow will build the agent and server binaries. Then deploy to CM servers. | |
name: Deploy to CM Server | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "**.md" | |
- ".gitignore" | |
- "LICENSE" | |
- "CODEOWNERS" | |
- "docs/**" | |
- "scripts/**" | |
- "_airflow" | |
jobs: | |
build-and-deploy: | |
name: Build and deploy | |
strategy: | |
matrix: | |
go-version: ["1.23.0"] | |
os: [ubuntu-22.04] | |
runs-on: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{matrix.go-version}} | |
- name: Build | |
run: make | |
- name: Copy binary to NFS server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.CM_SERVER_IP_NFS }} | |
username: ${{ secrets.CM_SERVER_SSH_USER }} | |
password: ${{ secrets.CM_SERVER_SSH_PASSWORD }} | |
port: ${{ secrets.CM_SERVER_SSH_PORT }} | |
source: "cmd/cm-cicada/cm-cicada" | |
target: "/tmp/" | |
strip_components: 2 | |
overwrite: true | |
- name: Restart service from NFS server with new binary | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.CM_SERVER_IP_NFS }} | |
username: ${{ secrets.CM_SERVER_SSH_USER }} | |
password: ${{ secrets.CM_SERVER_SSH_PASSWORD }} | |
port: ${{ secrets.CM_SERVER_SSH_PORT }} | |
script: | | |
systemctl stop cm-cicada | |
mv -f /tmp/cm-cicada /usr/bin/cm-cicada | |
systemctl start cm-cicada |