Remove uptime-kuma not used and costs me money #210
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
--- | |
name: "Publish Terraform as OCI" | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["main"] | |
paths: ["terraform/**"] | |
jobs: | |
changed-files: | |
name: Generate Build Matrix | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Generate Token | |
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | |
id: generate-token | |
with: | |
app_id: "${{ secrets.BOT_APP_ID }}" | |
private_key: "${{ secrets.BOT_APP_PRIVATE_KEY }}" | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
token: "${{ steps.generate-token.outputs.token }}" | |
fetch-depth: 0 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@cc733854b1f224978ef800d29e4709d5ee2883e4 # v44.5.5 | |
with: | |
dir_names: true | |
dir_names_max_depth: 2 | |
json: true | |
files: | | |
terraform/** | |
- name: List all changed files | |
run: | | |
echo '${{ steps.changed-files.outputs.all_changed_files }}' | |
- id: set-matrix | |
run: echo "matrix={\"project\":${{ steps.changed-files.outputs.all_changed_files }}}" >> "${GITHUB_OUTPUT}" | |
publish-terraform: | |
name: Publish OCI | |
runs-on: ubuntu-latest | |
needs: [changed-files] | |
strategy: | |
matrix: ${{ fromJSON(needs.changed-files.outputs.matrix) }} | |
steps: | |
- name: Generate Token | |
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | |
id: generate-token | |
with: | |
app_id: "${{ secrets.BOT_APP_ID }}" | |
private_key: "${{ secrets.BOT_APP_PRIVATE_KEY }}" | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
token: "${{ steps.generate-token.outputs.token }}" | |
- 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@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish OCI | |
run: | | |
flux push artifact oci://ghcr.io/mchestr/terraform-$(basename ${{ matrix.project }})-oci:$(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/mchestr/terraform-$(basename ${{ matrix.project }})-oci:$(git rev-parse --short HEAD) \ | |
--tag main |