commit 4ebd3d860161d5d27e564b7d4813787f1d319fa1 Author: Sergio Talens-Oliag Date: Thu May 1 14:56:53 2025 +0200 Initial commit, includes the README.md and the workflows for the repo. diff --git a/.forgejo/package.json.tmpl b/.forgejo/package.json.tmpl new file mode 100644 index 0000000..00fcee0 --- /dev/null +++ b/.forgejo/package.json.tmpl @@ -0,0 +1,9 @@ +{ + "name": "multi-semantic-release", + "version": "0.0.0-semantically-released", + "private": true, + "multi-release": { + "tagFormat": "${name}-v${version}" + }, + "workspaces": {{ .applications | toJson }} +} diff --git a/.forgejo/workflows/multi-semantic-release.yaml b/.forgejo/workflows/multi-semantic-release.yaml new file mode 100644 index 0000000..61c0f95 --- /dev/null +++ b/.forgejo/workflows/multi-semantic-release.yaml @@ -0,0 +1,50 @@ +name: multi-semantic-release + +# This monorepo only tags releases from the main branch +on: + push: + branches: + - 'main' + +jobs: + multi-semantic-release: + runs-on: docker + container: + image: forgejo.mixinet.net/oci/multi-semantic-release:latest + steps: + - name: Checkout the repo + uses: actions/checkout@v4 + + - name: Generate multi-semantic-release configuration + shell: sh + run: | + # Get the list of kustomize applications to work with (the folders that have a kustomization.yaml file) + applications="$(for app in */kustomization.yaml; do dirname "$app"; done)" + # Generate a values.yaml file for the main packages.json file + package_json_values_yaml=".package.json-values.yaml" + echo "applications:" >"$package_json_values_yaml" + for app in $applications; do + echo " - $app" >>"$package_json_values_yaml"; + done + echo "::group::Generated values.yaml for the project" + cat "$package_json_values_yaml" + echo "::endgroup::" + # Generate the package.json file validating that is a good json file with jq + tmpl -f "$package_json_values_yaml" ".forgejo/package.json.tmpl" | jq . > "package.json" + echo "::group::Generated package.json for the project" + cat "package.json" + echo "::endgroup::" + # Remove the temporary values file + rm -f "$package_json_values_yaml" + # Generate the package.json file for each image + for app in $applications; do + tmpl -v "app_name=$app" -v "app_path=$app" ".forgejo/ws-package.json.tmpl" | jq . > "$app/package.json" + echo "::group::Generated package.json for the '$app' application" + cat "$app/package.json" + echo "::endgroup::" + done + + - name: Run multi-semantic-release + shell: sh + run: | + multi-semantic-release | tee .multi-semantic-release.log diff --git a/.forgejo/ws-package.json.tmpl b/.forgejo/ws-package.json.tmpl new file mode 100644 index 0000000..e5e70ff --- /dev/null +++ b/.forgejo/ws-package.json.tmpl @@ -0,0 +1,57 @@ +{ + "name": "{{ .app_name }}", + "license": "UNLICENSED", + "release": { + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits", + "releaseRules": [ + { + "breaking": true, + "release": "major" + }, + { + "revert": true, + "release": "patch" + }, + { + "type": "feat", + "release": "minor" + }, + { + "type": "fix", + "release": "patch" + }, + { + "type": "perf", + "release": "patch" + } + ] + } + ], + [ + "semantic-release-replace-plugin", + { + "replacements": [ + { + "files": [ "{{ .app_path }}/msr.yaml" ], + "from": "^version:.*$", + "to": "version: ${nextRelease.version}", + "allowEmptyPaths": true + } + ] + } + ], + [ + "@semantic-release/git", + { + "assets": [ "msr.yaml" ], + "message": "ci(release): {{ .app_name }}-v${nextRelease.version}\n\n${nextRelease.notes}" + } + ] + ], + "branches": [ "main" ] + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..e44a40f --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# ArgoCD Applications Repository + +This repository contains [kustomize](https://kustomize.io/) application definitions to be used with `ArgoCD`. + +The repository is a monorepo managed using [multi-semantic-release](https://github.com/qiwi/multi-semantic-release) to +allow us to reference specific versions of each application.