Created
February 15, 2024 21:04
-
-
Save PenguinOfWar/69e9547ea184cf2a680d914b418c5f26 to your computer and use it in GitHub Desktop.
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
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/[email protected] | |
- 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