-
Notifications
You must be signed in to change notification settings - Fork 146
75 lines (64 loc) · 2.48 KB
/
build-cloud-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
name: Build Cloud Images
on:
release:
types: [released]
workflow_dispatch:
inputs:
monitor_version:
description: 'Git tag to build from'
required: true
jobs:
build-cloud-images:
runs-on: ubuntu-latest
permissions:
contents: 'write'
id-token: 'write'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Packer
uses: hashicorp/[email protected]
with:
version: '1.10.0'
- name: Setup AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.MONITOR_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.MONITOR_AWS_SECRET_ACCESS_KEY }}
aws-region: 'us-east-1'
- name: Setup GCP credentials
uses: google-github-actions/[email protected]
with:
workload_identity_provider: ${{ secrets.MONITOR_GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.MONITOR_GCP_SERVICE_ACCOUNT }}
- name: Determine Scylla Monitor version
run: |
if ${{ github.event_name == 'workflow_dispatch' }}; then
echo "MONITOR_VERSION=${{ github.event.inputs.monitor_version }}" >> $GITHUB_ENV
elif ${{ github.event_name == 'release' }}; then
echo "MONITOR_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
else
echo "Missing Scylla Monitor version - Workflow cannot continue"
exit 1
fi
- name: Build Images
run: |
packer plugins install github.com/hashicorp/googlecompute
packer plugins install github.com/hashicorp/amazon
packer build -var monitor_version="$MONITOR_VERSION" scylla-monitor-template.json
working-directory: packer
- name: Archive Packer manifest
uses: actions/upload-artifact@v4
with:
name: scylla-monitor-cloud-images-${{ env.MONITOR_VERSION }}
path: packer/packer-manifest.json
- name: Upload Packer manifest to the release
if: github.event_name == 'release' && github.event.release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: packer/packer-manifest.json
asset_name: scylla-monitor-cloud-images-${{ env.MONITOR_VERSION }}.json
asset_content_type: application/json