Skip to content

Commit

Permalink
Use scp to send binary
Browse files Browse the repository at this point in the history
  • Loading branch information
nickclyde committed Sep 3, 2024
1 parent 80ed50a commit 49fa59b
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,42 @@ jobs:
azcliversion: latest
inlineScript: |
az account show
- name: Allow GitHub Runner IP
uses: azure/cli@v2
with:
inlineScript: |
set -eu
agentIP=$(curl -s https://api.ipify.org/)
az network nsg rule create \
--resource-group phinvads-go \
--nsg-name phinvads-go-nsg \
--name AllowSSHFromGitHubActions \
--priority 200 \
--direction Inbound \
--access Allow \
--protocol Tcp \
--destination-port-ranges 22 \
--source-address-prefixes $agentIP \
--destination-address-prefixes '*' \
--description "Allow SSH from GitHub Actions"
sleep 30
- name: Deploy phinvads-go to VM
env:
AZURE_VM_IP: ${{ secrets.AZURE_VM_IP }}
AZURE_VM_SSH_KEY: ${{ secrets.AZURE_VM_SSH_KEY }}
run: |
go build -o phinvads-go ./cmd/phinvads-go
scp -i <(echo "$AZURE_VM_SSH_KEY") ./phinvads-go azureuser@${AZURE_VM_IP}:/home/azureuser/phinvads-go
- name: Disallow GitHub Runner IP
uses: azure/cli@v2
with:
inlineScript: |
set -eu
agentIP=$(curl -s https://api.ipify.org/)
az network nsg rule remove \
--resource-group phinvads-go \
--nsg-name phinvads-go-nsg \
--name AllowSSHFromGitHubActions

0 comments on commit 49fa59b

Please sign in to comment.