Skip to content

Add tag in packer sources #5

Add tag in packer sources

Add tag in packer sources #5

Workflow file for this run

name: Build AWS Neuron AMI
on:
push:
branches:
- main
paths:
- 'aws-ami-creation/**'

Check failure on line 8 in .github/workflows/build-ami.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-ami.yml

Invalid workflow file

You have an error in your yaml syntax on line 8
workflow_dispatch:
inputs:
tag:
description: 'Tag to use for the AMI'
schedule:
# Schedule the workflow to run every second day at midnight UTC
- cron: '0 0 */2 * *'
jobs:
build-ami:
defaults:
run:
working-directory: infrastructure/ami
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-packer@main
- name: Determine tag
id: determine-tag
run: echo "::set-output name=TAG::${{ github.event.inputs.tag || github.ref }}"
- name: Use specific tag
run: echo "Building tag ${{ steps.determine-tag.outputs.TAG }}"
- 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: us-east-1
- name: Packer format
id: format
run: packer fmt hcl2-files
continue-on-error: true
- name: Packer Init
id: init
run: packer init hcl2-files
continue-on-error: true
- name: Packer Validate
id: validate
run: packer validate hcl2-files
continue-on-error: true
- name: Packer Build
id: build
run: |
SOURCE_AMI=ami-077399be2d0ae7e0c
packer build -var "source_ami=$SOURCE_AMI" -var "tag_name=${{ steps.determine-tag.outputs.TAG }}" hcl2-files