feat: add PR title validation #26
This file contains hidden or 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
| name: CI/CD Binary Deployment via VPN | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| build: | |
| name: Build ARM64 Binary | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.26.1" | |
| cache: true | |
| - name: Build for Graviton (ARM64) | |
| run: | | |
| CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o goperf-linux-arm64 . | |
| - name: Upload Binary Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: goperf-binary | |
| path: goperf-linux-arm64 | |
| retention-days: 1 | |
| deploy: | |
| name: Deploy to Private VM | |
| needs: build | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Download Binary Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: goperf-binary | |
| - name: Setup WireGuard VPN | |
| uses: egor-tensin/setup-wireguard@v1 | |
| with: | |
| endpoint: ${{ secrets.WG_SERVER_ENDPOINT }} | |
| endpoint_public_key: ${{ secrets.WG_SERVER_PUBLIC_KEY }} | |
| private_key: ${{ secrets.WG_PRIVATE_KEY }} | |
| ips: "${{ vars.VPN_CLIENT_IP }}/32" | |
| allowed_ips: "${{ vars.TARGET_PRIVATE_IP }}/32" | |
| - name: Copy Binary to VM | |
| uses: appleboy/scp-action@v1 | |
| with: | |
| host: ${{ vars.TARGET_PRIVATE_IP }} | |
| username: ${{ secrets.SSH_USER }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| source: "goperf-linux-arm64" | |
| target: "/home/${{ secrets.SSH_USER }}/" | |
| - name: Finalize Deployment | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ vars.TARGET_PRIVATE_IP }} | |
| username: ${{ secrets.SSH_USER }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| script: | | |
| mv ~/goperf-linux-arm64 ~/goperf | |
| chmod +x ~/goperf | |
| echo "Deployment successful. Run binary with: ./goperf" |