65
loading...
This website collects cookies to deliver better user experience
I recently developed, deployed my first github Action and published the action to GitHub Actions Marketplace. The Action build packer images on AWS. I wanted an action to build simple packer images and i decided to pick up the challenge.
packer-build.yml
in the parent directory. The file will be created in .github/workflows/packer-build.yaml. See screenshot below.packer.yaml
file.name: Run packer build on a template file
on:
push:
branches:
- 'master'
jobs:
packer_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Packer build
uses: ExitoLab/[email protected]
with:
templateFile: 'ami.json'
workingDir: 'ami'
varFile: 'variables.json'
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
push to master branch
. The input parameters are the; working directory and template file. The workingDir
is defined as the directory where the packer template and var file reside. The templateFile
contains the packer template file for building packer AMI. The access_key and secret_key are used for authenticating to AWS will be stored in GitHub secrets.AWS_ACCESS_KEY
and AWS_SECRET_KEY
in the Github secrets. Under your repository name, click Settings. In the left sidebar, click Secrets. See image below