diff --git a/.github/workflows/release_created.yaml b/.github/workflows/release_created.yaml new file mode 100644 index 0000000..802ef28 --- /dev/null +++ b/.github/workflows/release_created.yaml @@ -0,0 +1,35 @@ +name: Github Release Created + +on: + release: + types: ["published"] # Inherits all input defaults + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + deploy-main: + name: Package and Publish Terraform Modules to GitHub Releases assets + runs-on: ubuntu-latest + + permissions: + id-token: write + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v5.0.0 + + - name: "Package and Publish Terraform modules" + run: | + cd infrastructure/modules + for module in */; do + module_name=${module%/} + echo "Zipping contents of $module_name..." + (cd "$module_name" && zip -r "../../../artifacts/terraform-${module_name}.zip" .) + echo "Publishing $module_name module..." + gh release upload ${{ github.event.release.tag_name }} "../../artifacts/terraform-${module_name}.zip" --clobber + done + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}