-
Notifications
You must be signed in to change notification settings - Fork 6
81 lines (70 loc) · 2.76 KB
/
machine_images.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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