AWS Marketplace AMI Creation Workflow #58
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
# This is a basic workflow to help you get started with Actions | |
name: AWS Marketplace AMI Creation Workflow | |
# Controls when the action will run. | |
on: | |
workflow_dispatch: | |
inputs: | |
name: | |
description: "AMI Name" | |
required: true | |
region: | |
description: "AWS Region" | |
required: true | |
default: "us-east-1" | |
version: | |
description: "Couchbase Server/Gateway Version" | |
required: true | |
default: "6.6.2" | |
arm: | |
description: "Arm AMI (Y/N)?" | |
type: choice | |
options: | |
- "Y" | |
- "N" | |
required: true | |
default: "N" | |
syncgateway: | |
description: "Gateway (Y/N)?" | |
type: choice | |
options: | |
- "Y" | |
- "N" | |
required: true | |
default: "N" | |
syncgatewayversion: | |
description: "Couchbase Sync Gateway Version" | |
required: true | |
default: "2.8.2" | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
aws-ami-release: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
- name: Set up Arm Parameter With ARM | |
if: startsWith(github.event.inputs.arm, 'Y') | |
run: | | |
echo "ARM=-a" >> $GITHUB_ENV | |
- name: Set up without ARM | |
if: startsWith(github.event.inputs.arm, 'N') | |
run: | | |
echo "ARM=" >> $GITHUB_ENV | |
# Runs a single command using the runners shell | |
- name: Setup AWS CLI | |
run: | | |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID | |
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY | |
aws configure set default.region $AWS_REGION | |
aws configure get region | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CM_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CM_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ github.event.inputs.region }} | |
# Runs a set of commands using the runners shell | |
- name: Create AMI for Couchbase Server | |
if: ${{ github.event.inputs.syncgateway == 'N' }} | |
env: | |
NAME: ${{github.event.inputs.name}} | |
REGION: ${{github.event.inputs.region}} | |
VERSION: ${{github.event.inputs.version}} | |
timeout-minutes: 15 | |
run: | | |
bash ${GITHUB_WORKSPACE}/aws/couchbase-ami-creation/create.sh \ | |
-r "$REGION" \ | |
-n "$NAME" \ | |
-v "$VERSION" \ | |
${{ env.ARM }} | |
- name: Create AMI for Couchbase Sync Gateway | |
if: ${{ github.event.inputs.syncgateway == 'Y' }} | |
env: | |
NAME: ${{github.event.inputs.name}} | |
REGION: ${{github.event.inputs.region}} | |
VERSION: ${{github.event.inputs.syncgatewayversion}} | |
timeout-minutes: 15 | |
run: | | |
bash ${GITHUB_WORKSPACE}/aws/couchbase-ami-creation/create.sh \ | |
-r "$REGION" \ | |
-n "$NAME" \ | |
-v "$VERSION" \ | |
-g \ | |
${{ env.ARM }} | |
- name: Upload AMI details | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{github.event.inputs.name}}.json | |
path: build/aws/couchbase-ami-creation/${{github.event.inputs.name}}.json | |
retention-days: 14 | |