Skip to content

Instantly share code, notes, and snippets.

@PenguinOfWar
Created February 15, 2024 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PenguinOfWar/69e9547ea184cf2a680d914b418c5f26 to your computer and use it in GitHub Desktop.
Save PenguinOfWar/69e9547ea184cf2a680d914b418c5f26 to your computer and use it in GitHub Desktop.
name: Deploy (Dev)
concurrency: development
on:
push:
branches: ["main"]
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: development
env:
AWS_INSTANCE_SG_ID: {instance-id}
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Configure AWS credentials 🔧
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_ACCESS_KEY_SECRET }}
aws-region: us-east-1
- name: Get runner IP address 🛜
id: ip
uses: haythem/public-ip@v1.3
- name: Whitelist runner IP address ✅
run: |
aws ec2 authorize-security-group-ingress \
--group-id $AWS_INSTANCE_SG_ID \
--protocol tcp \
--port 22 \
--cidr ${{ steps.ip.outputs.ipv4 }}/32
- name: Revoke runner IP address ❌
run: |
aws ec2 revoke-security-group-ingress \
--group-id $AWS_INSTANCE_SG_ID \
--protocol tcp \
--port 22 \
--cidr ${{ steps.ip.outputs.ipv4 }}/32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment