Build Cloud Images #2
Workflow file for this run
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
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 |