v1.1.0 #2
Workflow file for this run
This file contains hidden or 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
name: Build Release | |
on: | |
release: | |
types: [published] | |
env: | |
IAC: ${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}-stack.zip | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
id-token: write | |
steps: | |
- name: Output Environment | |
run: | | |
echo "IaC: ${{ env.IAC }}" | |
- name: Validate Tag Name | |
run: | | |
if [[ ! $GITHUB_REF_NAME =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then | |
echo "Invalid tag name format. Must be in the format vMAJOR.MINOR.PATCH" | |
exit 1 | |
fi | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build and Push Infrastructure as Code | |
run: | | |
cd opentofu | |
zip -r ${{ env.IAC }} . -x "terraform*" ".terraform*" "*/terraform*" "*/.terraform*" "generated/*" | |
gh release upload ${{github.event.release.tag_name}} ${{ env.IAC }} --clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: bash |