From a283091b84aee27236ce0697c153a4a4b7a9f774 Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Sat, 4 May 2024 00:54:43 +0200 Subject: [PATCH 1/4] fix: adjust galaxy version for commitizen --- galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galaxy.yml b/galaxy.yml index aa1a6dc..ba0b33f 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: ednz_cloud name: hashistack -version: 1.0.0 +version: 0.1.0 readme: README.md authors: - Bertrand Lanson -- 2.45.2 From efce0e6b83b387af56c03fb7166fdfa246a1f4b1 Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Sat, 4 May 2024 00:55:36 +0200 Subject: [PATCH 2/4] chore: add commitizen automatic versioning --- .cz.toml | 6 +++ .gitea/workflows/development.yml | 31 +++++++++++++++ .gitea/workflows/pull-request-open.yml | 35 ++++++++++++++++ .gitea/workflows/release.yml | 55 ++++++++++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 .cz.toml create mode 100644 .gitea/workflows/development.yml create mode 100644 .gitea/workflows/pull-request-open.yml create mode 100644 .gitea/workflows/release.yml diff --git a/.cz.toml b/.cz.toml new file mode 100644 index 0000000..44008ce --- /dev/null +++ b/.cz.toml @@ -0,0 +1,6 @@ +[tool.commitizen] +name = "cz_conventional_commits" +version_provider = "scm" +version_files = ["galaxy.yml:^version"] +update_changelog_on_bump = true +major_version_zero = true diff --git a/.gitea/workflows/development.yml b/.gitea/workflows/development.yml new file mode 100644 index 0000000..da82e9e --- /dev/null +++ b/.gitea/workflows/development.yml @@ -0,0 +1,31 @@ +--- +name: development +on: + push: + branches-ignore: + - main + +jobs: + commit-check: + name: Check commit compliance + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: "pip" + + - name: Install commitizen + run: pip3 install commitizen + shell: bash + working-directory: ./ + + - name: Verify commit message compliance + run: | + echo "cz check --message '${{ github.event.head_commit.message }}'" + cz check --message "${{ github.event.head_commit.message }}" + shell: bash + working-directory: ./ diff --git a/.gitea/workflows/pull-request-open.yml b/.gitea/workflows/pull-request-open.yml new file mode 100644 index 0000000..ea2a600 --- /dev/null +++ b/.gitea/workflows/pull-request-open.yml @@ -0,0 +1,35 @@ +--- +name: pull-requests-open +on: + pull_request: + types: + - opened + - edited + - synchronize + branches: + - main + +jobs: + commit-history-check: + name: Check commit compliance + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: Install commitizen + run: pip3 install commitizen + shell: bash + working-directory: ./ + + - run: git log origin/${{ github.event.pull_request.base.ref }}.. + + - name: Verify commit message compliance + run: | + echo "cz check --rev-range origin/${{ gitea.event.pull_request.base.ref }}.." + cz check --rev-range origin/${{ gitea.event.pull_request.base.ref }}.. + shell: bash + working-directory: ./ diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..620539c --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,55 @@ +--- +name: build-deploy +on: + push: + branches: + - main + +jobs: + do-release: + if: "!startsWith(github.event.head_commit.message, 'bump:')" + runs-on: ubuntu-latest + name: Bump version and create changelog with commitizen + needs: deploy + steps: + - name: Get secrets from vault + id: import-secrets + uses: hashicorp/vault-action@v3 + with: + url: "https://vault.ednz.fr" + method: approle + roleId: ${{ secrets.VAULT_APPROLE_ID }} + secretId: ${{ secrets.VAULT_APPROLE_SECRET_ID }} + secrets: | + kv/data/applications/gitea/users/actions username | GITEA_ACTIONS_USERNAME ; + kv/data/applications/gitea/users/actions token_write | GITEA_ACTIONS_TOKEN ; + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ steps.import-secrets.outputs.GITEA_ACTIONS_TOKEN }} + + - name: Install commitizen + run: pip3 install commitizen + shell: bash + working-directory: ./ + + - name: Configure git credentials + uses: oleksiyrudenko/gha-git-credentials@v2 + with: + global: true + name: "Gitea-Actions Bot" + email: "gitea-actions@ednz.fr" + actor: ${{ steps.import-secrets.outputs.GITEA_ACTIONS_USERNAME }} + token: ${{ steps.import-secrets.outputs.GITEA_ACTIONS_TOKEN }} + + - name: Do release + run: cz -nr 21 bump --yes + shell: bash + working-directory: ./ + + - name: Push release + run: git push && git push --tags + shell: bash + working-directory: ./ -- 2.45.2 From 13672f774ea7959ccbe2515567dfbe87d9f26a12 Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Sat, 4 May 2024 00:58:43 +0200 Subject: [PATCH 3/4] ci: do not cache pip for ci pipeline (this is not a python repo) --- .gitea/workflows/development.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitea/workflows/development.yml b/.gitea/workflows/development.yml index da82e9e..4f5c90a 100644 --- a/.gitea/workflows/development.yml +++ b/.gitea/workflows/development.yml @@ -16,7 +16,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.11" - cache: "pip" - name: Install commitizen run: pip3 install commitizen -- 2.45.2 From bd5f217682373b5a98a8f5bf6d1be933994f8b42 Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Sat, 4 May 2024 01:00:00 +0200 Subject: [PATCH 4/4] ci: remove the python setup step altogether --- .gitea/workflows/development.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitea/workflows/development.yml b/.gitea/workflows/development.yml index 4f5c90a..bfba126 100644 --- a/.gitea/workflows/development.yml +++ b/.gitea/workflows/development.yml @@ -13,10 +13,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Install commitizen run: pip3 install commitizen shell: bash -- 2.45.2