Skip to content

Instantly share code, notes, and snippets.

@MiyamotoTa
Last active April 19, 2021 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MiyamotoTa/705b18449165f7472f42382adfe4807c to your computer and use it in GitHub Desktop.
Save MiyamotoTa/705b18449165f7472f42382adfe4807c to your computer and use it in GitHub Desktop.
Packer workflow
---
name: Packer
on:
workflow_dispatch:
push:
jobs:
packer:
runs-on: ubuntu-latest
name: packer
steps:
- name: Checkout Repository
uses: actions/checkout@v2
# fix backwards incompatibilities in template
- name: Fix Template
uses: hashicorp/packer-github-actions@master
with:
command: fix
target: example.pkr.hcl
# validate templates
- name: Validate Template
uses: hashicorp/packer-github-actions@master
with:
command: validate
arguments: -syntax-only
target: example.pkr.hcl
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-1
# build artifact
- name: Build Artifact
uses: hashicorp/packer-github-actions@master
with:
command: build
arguments: "-color=false -on-error=abort"
target: example.pkr.hcl
env:
PACKER_LOG: 1
# additional steps to process artifacts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment