Merge pull request #42 from junior/ZeroTEN #32
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
# Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved. | |
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | |
# | |
# Creates and Publishes the Oracle Resource Manager stack - v0.0.5 | |
name: Generate stacks and publish release | |
on: | |
push: | |
branches: [ main ] | |
paths: ['VERSION'] | |
jobs: | |
publish_stack: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Create stacks | |
id: create_stacks | |
run: | | |
# | |
STACKNAME=${{ github.event.repository.name }} | |
STACK_FILES="*.tf schema.yaml README.md LICENSE VERSION .terraform.lock.hcl modules/" | |
RELEASE=$(cat VERSION) | |
ASSETS+="${STACKNAME}-stack.zip ${STACKNAME}-${RELEASE}.zip " | |
echo "::group::Generating standalone providers.tf" | |
cp -f providers.tf.example providers.tf || { printf '\n providers.tf.example ignored.\n'; exit 0; } | |
echo "::endgroup::" | |
echo "::group::Processing $STACKNAME" | |
zip -r ${STACKNAME}-stack.zip $STACK_FILES -x "*.tfstat*" ".terraform/" || { printf '\n⛔ Unable to create %s stack.\n'; exit 1; } | |
cp ${STACKNAME}-stack.zip ${STACKNAME}-${RELEASE}.zip || { printf '\n⛔ Unable to create %s stack.\n'; exit 1; } | |
echo "::endgroup::" | |
echo "::set-output name=assets::$ASSETS" | |
echo "::set-output name=release::$RELEASE" | |
echo "::set-output name=prefix::$STACKNAME" | |
- name: Prepare Release Notes | |
run: | | |
# | |
printf '%s\n' '${{ steps.create_stacks.outputs.prefix }} Stack - v${{ steps.create_stacks.outputs.release }}' >release.md | |
printf '%s\n' '' '## [![Deploy to Oracle Cloud][magic_button]][magic_stack]' >>release.md | |
printf '%s\n' '' '' >>release.md | |
printf '%s\n' '' '[magic_button]: https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg' >>release.md | |
printf '%s\n' '' '[magic_stack]: https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/${{ github.repository }}/releases/download/${{ steps.create_stacks.outputs.release }}/${{ steps.create_stacks.outputs.prefix }}-${{ steps.create_stacks.outputs.release }}.zip' >>release.md | |
- name: Create Release | |
run: gh release create ${{ steps.create_stacks.outputs.release }} --generate-notes -F release.md ${{ steps.create_stacks.outputs.assets }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |