coder-release #75
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@v3 | |
- 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: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v1 | |
with: | |
workload_identity_provider: projects/599002230295/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-oidc-provider | |
service_account: coder-packages-ci@coder-enterprise-market-public.iam.gserviceaccount.com | |
- name: Setup `packer` | |
uses: hashicorp/setup-packer@main | |
id: setup | |
with: | |
version: latest | |
- name: Run `packer init` | |
id: init | |
run: "packer init ./template.pkr.hcl" | |
- name: Run `packer validate` | |
id: validate | |
run: "packer validate ./template.pkr.hcl" | |
- name: Build Artifact | |
run: | | |
packer build \ | |
-force \ | |
-var "coder_version=${{ env.PKR_VAR_coder_version }}" \ | |
./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 | |
continue-on-error: true | |
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 }} | |
- name: Submit image to GCP Marketplace | |
run: ./.github/workflows/gcp/submit_image.sh |