You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
Packer AMI Builder
v0.3
Use GitHub Action to execute Packer build commands. This supports both HCL and JSON packer template files.
For HCL Mode, set packerArgs
to build .
to load all .pkr.hcl
files within
the dir. To use the override variable file, set packerArgs
to
build -var-file=overrides.pkrvars.hcl
Name | Description | Mandatory | Default |
---|---|---|---|
packerArgs |
Arguments that will be passed down to the packer command | Yes | |
workDir |
Working directory inside the container | No | . |
Create a workflow file (e.g .github/workflows/ami-build.yaml
) like below:
name: Build an AMI using Packer
on:
push:
branches:
- 'master'
jobs:
packer-ami-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Packer AMI Build
uses: zmingxie/packer-ami-builder@master
with:
packerArgs: 'build template.json'
workDir: '.'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1