This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Fixing PR #196
Workflow file for this run
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: Build and Deploy | |
on: push | |
jobs: | |
build_and_deploy: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create EC2 instance | |
uses: aws-actions/setup-ec2@v1 | |
with: | |
key-name: github_actions | |
security-group-ids: sg-00569d47240ff3c20 | |
subnet-id: subnet-0114278bab913da56 | |
instance-type: t2.micro | |
- name: Install Docker and GitHub runner | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker.io | |
sudo usermod -aG docker $USER | |
sudo curl -L "https://github.com/actions/runner/releases/download/v2.283.3/actions-runner-linux-x64-2.283.3.tar.gz" -o actions-runner.tar.gz | |
sudo tar xzf ./actions-runner.tar.gz | |
- name: Configure and start the runner | |
run: | | |
sudo ./config.sh --url https://github.com/my-org/my-repo --token my-token | |
sudo ./run.sh | |
- name: Build Docker image | |
run: | | |
docker build -t my-image:latest . | |
- name: Destroy EC2 instance | |
uses: aws-actions/terminate-ec2-instance@v1 | |
with: | |
instance-id: ${{ env.AWS_INSTANCE_ID }} |