coder-release #52
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
on: | |
repository_dispatch: | |
types: [coder-release] | |
workflow_dispatch: | |
inputs: | |
coder_version: | |
description: 'Coder Version' | |
required: true | |
default: 'x.x.x' | |
append_version: | |
description: 'Append version (e.g. ".1")' | |
default: '' | |
required: false | |
jobs: | |
packer_release: | |
runs-on: ubuntu-latest | |
name: packer | |
permissions: | |
contents: "read" | |
id-token: "write" | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set packer variables (repository_dispatch) | |
if: github.event_name == 'repository_dispatch' | |
run: | | |
echo "PKR_VAR_coder_version=${{ github.event.client_payload.coder_version }}" >> "$GITHUB_ENV" | |
echo "PKR_VAR_append_version=${{ github.event.client_payload.append_version }}" >> "$GITHUB_ENV" | |
- name: Set packer variables (workflow_dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
echo "PKR_VAR_coder_version=${{ github.event.inputs.coder_version }}" >> "$GITHUB_ENV" | |
echo "PKR_VAR_append_version=${{ github.event.inputs.append_version }}" >> "$GITHUB_ENV" | |
- name: Validate Template | |
uses: hashicorp/packer-github-actions@master | |
with: | |
command: validate | |
arguments: -syntax-only | |
target: template.pkr.hcl | |
- name: Install plugins | |
uses: hashicorp/packer-github-actions@master | |
with: | |
command: init | |
target: template.pkr.hcl | |
- name: Build Artifact | |
uses: hashicorp/packer-github-actions@master | |
with: | |
command: build | |
arguments: "-color=false -on-error=abort" | |
target: template.pkr.hcl | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Submit AMI to AWS Marketplace | |
run: ./.github/workflows/aws/submit_ami.sh | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: us-east-1 | |
VERSION: ${{ env.PKR_VAR_coder_version }} | |
MARKETPLACE_ACCESS_ROLE_ARN: ${{ secrets.MARKETPLACE_ACCESS_ROLE_ARN }} | |
PRODUCT_IDENTIFIER: ${{ secrets.PRODUCT_IDENTIFIER }} |