updated auth token in step 4/5 #7
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
# 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 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.VERSION }} | |
release_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-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
asset_path: artifacts/Resource_Manager_Template-${{ env.VERSION }}.zip | |
asset_name: Resource_Manager_Template-${{ env.VERSION }}.zip | |
asset_content_type: application/zip | |