/packer-github-action

Primary LanguageShellApache License 2.0Apache-2.0

GitHub Action: Packer Build

GitHub Action for running Packer build.

Table of Contents

Usage

Add the Action to your GitHub Workflow like so:

---

name: Packer

on:
  push:

jobs:
  packer:
    runs-on: ubuntu-latest
    name: packer

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2

      # build artifact
      - name: Packer build
        uses: gelbander/packer-github-action@v1
        with:
          workingDir: '.'
          templateFileName: 'basic.json'
          varList: 'git_sha=${{ github.sha }}'
        env:
          GOOGLE_APPLICATION_CREDENTIALS: service_account.json
          SERVICE_ACCOUNT_BASE64: ${{ secrets.SERVICE_ACCOUNT_BASE64 }}

      # additional steps

Inputs

Name Description Required Default
workingDir Working directory no .
templateFileName Configuration file no packer.json
varList key=val,key2=val2 no
varFileName target to -var-file argument no

varList

Key-value pairs eg. (key=value,key2=value2 translates into:

$ packer build \
    -var 'key=value' \
    -var 'key2=value2' \
    packer.json