Last active
April 19, 2021 21:18
-
-
Save MiyamotoTa/705b18449165f7472f42382adfe4807c to your computer and use it in GitHub Desktop.
Packer workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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