-
Notifications
You must be signed in to change notification settings - Fork 222
38 lines (36 loc) · 1.38 KB
/
gcp-a3mega-image.yml
File metadata and controls
38 lines (36 loc) · 1.38 KB
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
name: Build GCP A3 Mega VM image
on:
- workflow_dispatch
env:
PACKER_VERSION: "1.9.2"
IMAGE_VERSION: ${{ github.run_number }}
jobs:
build-gcp-images:
defaults:
run:
working-directory: scripts/packer
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: 'projects/531508670106/locations/global/workloadIdentityPools/github-identity-pool/providers/github-id-provider'
service_account: 'github-actions@dstack.iam.gserviceaccount.com'
create_credentials_file: true
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Download packer
run: |
wget https://releases.hashicorp.com/packer/${{ env.PACKER_VERSION }}/packer_${{ env.PACKER_VERSION }}_linux_amd64.zip
unzip packer_${{ env.PACKER_VERSION }}_linux_amd64.zip
chmod +x packer
- name: Run packer
run: |
./packer build -var image_version=${{ env.IMAGE_VERSION }} gcp-a3mega-image.json
- name: Publish image
run: |
gcloud compute images add-iam-policy-binding dstack-a3mega-${{ env.IMAGE_VERSION }} --member='allAuthenticatedUsers' --role='roles/compute.imageUser'