-
Notifications
You must be signed in to change notification settings - Fork 6
67 lines (55 loc) · 2.07 KB
/
gcp.ubuntu.20_04.yml
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
name: Build Ubuntu 20.04 VM Image on Google Compute
on:
- workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Copy init.sh
uses: canastro/copy-file-action@master
with:
source: "scripts/init.sh"
target: "packer/google/ubuntu/20_04/init.sh"
- name: Copy inventory.sh
uses: canastro/copy-file-action@master
with:
source: "scripts/inventory.sh"
target: "packer/google/ubuntu/20_04/inventory.sh"
- name: Copy kind-load-cafile.sh
uses: canastro/copy-file-action@master
with:
source: "scripts/kind-load-cafile.sh"
target: "packer/google/ubuntu/20_04/kind-load-cafile.sh"
- name: Copy fetch-tanzu-cli.sh
uses: canastro/copy-file-action@master
with:
source: "scripts/fetch-tanzu-cli.sh"
target: "packer/google/ubuntu/20_04/fetch-tanzu-cli.sh"
- name: Copy fetch-and-install-oci-cli.sh
uses: canastro/copy-file-action@master
with:
source: "scripts/fetch-and-install-oci-cli.sh"
target: "packer/google/ubuntu/20_04/fetch-and-install-oci-cli.sh"
- name: Authenticate
uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Use latest Packer
uses: hashicorp-contrib/setup-packer@v1
with:
packer-version: 1.7.8
- name: Initialize
working-directory: ./packer/google/ubuntu/20_04
run: packer init .
- name: Build image from template
working-directory: ./packer/google/ubuntu/20_04
run: |
echo '${{ secrets.GCP_SA_KEY }}' > ./creds.json
export GOOGLE_APPLICATION_CREDENTIALS="./creds.json"
packer build -only='standard.*' -var project_id=${{ secrets.GCP_PROJECT_ID }} .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}