Use taurusgroup/coreth fork #1
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: build-public-ami | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to create AMI from' | |
required: true | |
push: | |
tags: | |
- "*" | |
jobs: | |
build-public-ami-and-upload: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 45 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '~1.19.12' | |
check-latest: true | |
- run: go version | |
- name: Install aws cli | |
run: | | |
sudo apt update | |
sudo apt-get -y install packer python3-boto3 | |
- name: Get the tag | |
id: get_tag | |
run: | | |
if [[ ${{ github.event_name }} == 'push' ]]; | |
then | |
echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
else | |
echo "TAG=${{ inputs.tag }}" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- name: Set whether to skip ami creation in packer | |
run: | | |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
echo "Setting SKIP_CREATE_AMI to False" | |
echo "SKIP_CREATE_AMI=False" >> $GITHUB_ENV | |
fi | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.MARKETPLACE_ID }} | |
aws-secret-access-key: ${{ secrets.MARKETPLACE_KEY }} | |
aws-region: us-east-1 | |
- name: Create AMI and upload to marketplace | |
run: | | |
./.github/workflows/update-ami.py | |
env: | |
TAG: ${{ env.TAG }} | |
PRODUCT_ID: ${{ secrets.MARKETPLACE_PRODUCT }} | |
ROLE_ARN: ${{ secrets.MARKETPLACE_ROLE }} |