Skip to content

added a step to upload the zip to the release #5

added a step to upload the zip to the release

added a step to upload the zip to the release #5

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Generate Resource Manager Template Release
# Controls when the workflow will run
# Triggers the workflow on push or pull request events but only for the "main" branch
on:
push:
branches: [ "sbaliyambra/CSPG-51088-upload-terraform-template" ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "create-release"
create-release:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Step 1: Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# Step 2: Get version from templates
- name: Get version from templates
id: get_version
run: |
echo "Searching for template_version in outputs.tf..."
grep_result=$(grep -E 'output "template_version"' -A2 templates/Resource_Manager_Template/outputs.tf)
echo "Grep result:"
echo "$grep_result"
version=$(echo "$grep_result" | grep 'value' | sed -E 's/.*"(v[0-9]+\.[0-9]+\.[0-9]+)".*/\1/')
echo "Extracted version: $version"
if [ -z "$version" ]; then
echo "Error: template_version not found in outputs.tf" >&2
exit 1
fi
echo "VERSION=$version" >> $GITHUB_ENV
# Step 3: Create a ZIP for the Resource Manager Template Directory
- name: Create Resource_Manager_Template Zip
run: |
mkdir -p artifacts
cd templates/Resource_Manager_Template
zip -r ../../artifacts/Resource_Manager_Template-${{ env.VERSION }}.zip .
cd ../..
# Step 4: Create a GitHub Release
- name: Create GitHub Release
uses: actions/create-release@v1
with:
tag: ${{ env.VERSION }}
name: Release ${{env.VERSION}}
body: |
This release contains the terraform configuration for version ${{ env.VERSION }}.
draft: false
prerelease: false
# Step 5: Upload the ZIP file to the release
- name: Upload the ZIP file
uses: actions/upload-zip-to-release@v1
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
zip_path: artifacts/Resource_Manager_Template-${{ env.VERSION }}.zip
zip_name: Resource_Manager_Template-${{ env.VERSION }}.zip
content_type: application/zip