This is an automated email from the ASF dual-hosted git repository. pcongiusti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit d6d593f267c419c8f68a7449f00b560e8014a30d Author: Pasquale Congiusti <pasquale.congiu...@gmail.com> AuthorDate: Thu Dec 15 13:18:01 2022 +0100 feat(ci): automatic make generate * run `make generate` every night to refresh automatically the autogenerated resources * ignore resource.go Closes #3868 --- .github/actions/automatic-updates/action.yml | 60 ++++++++++++++++++++++++ .github/workflows/automatic-changelog-update.yml | 60 ------------------------ .github/workflows/automatic-updates.yml | 52 ++++++++++++++++++++ .gitignore | 1 + 4 files changed, 113 insertions(+), 60 deletions(-) diff --git a/.github/actions/automatic-updates/action.yml b/.github/actions/automatic-updates/action.yml new file mode 100644 index 000000000..126a90984 --- /dev/null +++ b/.github/actions/automatic-updates/action.yml @@ -0,0 +1,60 @@ +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: automatic-updates +description: 'action used to run automation required by the project' + +inputs: + branch-ref: + required: true + type: string + +runs: + using: "composite" + steps: + - name: "Checkout code" + uses: actions/checkout@v2 + with: + ref: ${{ inputs.branch-ref }} + persist-credentials: false + submodules: recursive + - name: Generate changelog + uses: ./.github/actions/changelog + with: + token: ${{ secrets.GITHUB_TOKEN }} + release_branch: ${{ inputs.branch-ref }} + - name: Commit files + env: + CI_USER: "github-actions[bot]" + CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com" + run: | + git config --local user.email "$CI_EMAIL" + git config --local user.name "$CI_USER" + git add CHANGELOG.md && git commit -m 'chore: changelog automatic update' && echo "changelog=1" >> $GITHUB_ENV || echo "No changes to CHANGELOG" + - name: Make generate and commit + env: + CI_USER: "github-actions[bot]" + CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com" + run: | + make generate + git add -A && git commit -m 'chore: make generate automatic update' && echo "make_generate=1" >> $GITHUB_ENV || echo "No changes to Make generate" + - name: Push changes + if: env.changelog == 1 || env.make_generate == 1 + env: + CI_USER: "github-actions[bot]" + CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com" + CI_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git push "https://$CI_USER:$ci_to...@github.com/$GITHUB_REPOSITORY.git" HEAD:${{ inputs.branch-ref }} diff --git a/.github/workflows/automatic-changelog-update.yml b/.github/workflows/automatic-changelog-update.yml deleted file mode 100644 index be6356bb7..000000000 --- a/.github/workflows/automatic-changelog-update.yml +++ /dev/null @@ -1,60 +0,0 @@ -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -name: Changelog - -on: - schedule: - # Run at 3 during the night - - cron: '0 3 * * *' - workflow_dispatch: - -jobs: - generate_changelog: - runs-on: ubuntu-20.04 - name: Generate changelog for main branch - if: github.ref == 'refs/heads/main' && github.repository == 'apache/camel-k' - steps: - - name: "Checkout camel-k" - uses: actions/checkout@v2 - with: - persist-credentials: false - submodules: recursive - - - name: Generate changelog - uses: ./.github/actions/changelog - with: - token: ${{ secrets.GITHUB_TOKEN }} - release_branch: "main" - - - name: Commit files - env: - CI_USER: "github-actions[bot]" - CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com" - run: | - git config --local user.email "$CI_EMAIL" - git config --local user.name "$CI_USER" - git add CHANGELOG.md && git commit -m 'Updated CHANGELOG.md' && echo "push=1" >> $GITHUB_ENV || echo "No changes to CHANGELOG.md" - - - name: Push changes - if: env.push == 1 - env: - CI_USER: "github-actions[bot]" - CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com" - CI_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git push "https://$CI_USER:$ci_to...@github.com/$GITHUB_REPOSITORY.git" HEAD:main diff --git a/.github/workflows/automatic-updates.yml b/.github/workflows/automatic-updates.yml new file mode 100644 index 000000000..9b3fe0933 --- /dev/null +++ b/.github/workflows/automatic-updates.yml @@ -0,0 +1,52 @@ +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +name: Automatic Updates + +on: + schedule: + - cron: '30 0 * * *' + workflow_dispatch: + +jobs: + main: + if: github.repository == 'apache/camel-k' + runs-on: ubuntu-20.04 + name: Generate changelog for main branch + steps: + - name: Automatic updates on main + uses: ./.github/actions/automatic-updates + with: + branch-ref: "main" + + v1_10_x: + if: github.repository == 'apache/camel-k' + runs-on: ubuntu-20.04 + steps: + - name: Automatic updates on release-1.10.x + uses: ./.github/actions/automatic-updates + with: + branch-ref: "release-1.10.x" + + v1_8_x_lts: + if: github.repository == 'apache/camel-k' + runs-on: ubuntu-20.04 + steps: + - name: Automatic updates on release-1.18.x + uses: ./.github/actions/automatic-updates + with: + branch-ref: "release-1.8.x" diff --git a/.gitignore b/.gitignore index 3cf2aec9e..4835016a2 100644 --- a/.gitignore +++ b/.gitignore @@ -168,3 +168,4 @@ config/**/*.gen.yaml config/**/*.gen.json *-installer* +pkg/resources/resources.go