forked from Liron-Refaeli/code2cloud-python-flask-webserver
-
Notifications
You must be signed in to change notification settings - Fork 10
47 lines (36 loc) · 1.1 KB
/
VM.yml
File metadata and controls
47 lines (36 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Build and Deploy VM Image
env:
AWS_REGION: us-east-1 # Replace with your desired AWS region
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- 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_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Build VM image
run: |
packer fmt -check .
packer init .
packer validate .
packer build -debug .
- name: Deploy VM image
run: |
# Deploy the VM image to your cloud provider
# Example for AWS using AWS CLI
aws ec2 describe-images --filters "Name=name,Values=my-vm-image"