Skip to content

Commit c8262cd

Browse files
committed
CCM-11751: Package and publish modules to Github
1 parent d719073 commit c8262cd

2 files changed

Lines changed: 9 additions & 17 deletions

File tree

.github/workflows/release_created.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ jobs:
3131
cd infrastructure/modules
3232
for module in */; do
3333
module_name=${module%/}
34-
zip -r "../../artifacts/terraform-${module_name}-${{ github.event.release.tag_name }}.zip" "$module_name"
34+
echo "Zipping contents of $module_name..."
35+
(cd "$module_name" && zip -r "../../artifacts/terraform-${module_name}-${{ inputs.version }}.zip" .)
3536
echo "Publishing $module_name module..."
3637
gh release upload ${{ github.event.release.tag_name }} "../../artifacts/terraform-${module_name}-${{ github.event.release.tag_name }}.zip" --clobber
3738
done

.github/workflows/stage-5-publish.yaml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,14 @@ jobs:
9393
- name: "Upload Terraform module artifacts"
9494
shell: bash
9595
run: |
96-
for file in ./artifacts/terraform-*.zip; do
97-
artifact_name=$(basename "$file" .zip)
98-
echo "Uploading $file as artifact $artifact_name"
99-
gh api \
100-
-X POST \
101-
-H "Accept: application/vnd.github+json" \
102-
/repos/${{ github.repository }}/actions/artifacts \
103-
-F name="$artifact_name" \
104-
-F file=@"$file"
96+
cd infrastructure/modules
97+
for module in */; do
98+
module_name=${module%/}
99+
echo "Zipping contents of $module_name..."
100+
(cd "$module_name" && zip -r "../../artifacts/terraform-${module_name}-${{ inputs.version }}.zip" .)
101+
echo "Publishing $module_name module..."
102+
gh release upload ${{ inputs.version }} "../../artifacts/terraform-${module_name}-${{ inputs.version }}.zip" --clobber
105103
done
106-
env:
107-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108-
# uses: actions/upload-artifact@v4
109-
# with:
110-
# name: terraform-modules-${{ inputs.version }}
111-
# path: ./artifacts/terraform-*.zip
112-
# overwrite: true
113104
success:
114105
name: "Success notification"
115106
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)