Skip to content

update packer (#2174) #40

update packer (#2174)

update packer (#2174) #40

name: build-public-ami
on:
schedule:
- cron: '10 10 * * 1'
push:
tags:
- "*"
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
env:
PACKER_VERSION: "1.11.2"
jobs:
build-public-ami-and-upload:
name: Build Public AMIs for AWS and GCP
runs-on: ubuntu-20.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '~1.21.9'
check-latest: true
- run: go version
- name: install nodejs
uses: actions/setup-node@v3
with:
node-version: '16'
- name: install npx aws-amicleaner
run: npm install -g aws-amicleaner
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: us-east-1
- name: clean up old AMIs
run: npx aws-amicleaner --include-name 'public-avalanchecli-ubuntu-*' --exclude-newest 1 --exclude-days 2 --region="*" --force
env:
AWS_REGION: us-east-1
- name: Configure GCP credentials
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.EXPERIMENTAL_GCP_SA_KEY_PACKER }}
- name: Setup `packer`
uses: hashicorp/setup-packer@main
id: setup
with:
version: ${{ env.PACKER_VERSION }}
- name: Run `packer init`
id: init
run: "packer init ./.github/packer/aws-ubuntu-docker.pkr.hcl"
- name: Run `packer validate`
id: validate
run: "packer validate ./.github/packer/aws-ubuntu-docker.pkr.hcl"
- name: Run `packer build`
id: build
run: "packer build -color=false -force ./.github/packer/aws-ubuntu-docker.pkr.hcl"