Skip to content

feat(terraform): update terraform cloudflare to v4.51.0 (#4680) #211

feat(terraform): update terraform cloudflare to v4.51.0 (#4680)

feat(terraform): update terraform cloudflare to v4.51.0 (#4680) #211

---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Terraform: Build OCI artifacts"
on: # yamllint disable-line rule:truthy
workflow_dispatch:
push:
branches:
- main
paths:
- "infrastructure/terraform/**"
jobs:
changed-files:
name: Generate matrix for building images
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Setup Tools
run: |
brew install jo
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6
with:
dir_names: true
dir_names_max_depth: 3
json: true
files: |
infrastructure/terraform/**
- name: List all changed files
run: |
echo '${{ steps.changed-files.outputs.all_changed_files }}'
- name: Store changed projects
id: set-matrix
run: |
if [[ "${{ steps.changed-files.outputs.all_changed_files }}" == "[]" ]]; then
echo "matrix={\"project\":$(find infrastructure/terraform -type d -mindepth 1 -maxdepth 1 | jo -a)}" >> "${GITHUB_OUTPUT}"
else
echo "matrix={\"project\":${{ steps.changed-files.outputs.all_changed_files }}}" >> "${GITHUB_OUTPUT}"
fi
publish:
runs-on: ubuntu-latest
needs:
- changed-files
strategy:
matrix: ${{ fromJSON(needs.changed-files.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Setup Tools
run: |
brew install fluxcd/tap/flux
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish OCI
run: |
flux push artifact "oci://ghcr.io/larivierec/terraform/$(basename ${{ matrix.project }}):$(git rev-parse --short HEAD)" \
--path="./${{ matrix.project }}" \
--source="$(git config --get remote.origin.url)" \
--revision="$(git branch --show-current)/$(git rev-parse HEAD)"
- name: Tag OCI
run: |
flux tag artifact "oci://ghcr.io/larivierec/terraform/$(basename ${{ matrix.project }}):$(git rev-parse --short HEAD)" \
--tag main