diff --git a/.github/actions/automatic-updates/action.yml b/.github/actions/automatic-updates/action.yml new file mode 100644 index 0000000000..7757eddd9f --- /dev/null +++ b/.github/actions/automatic-updates/action.yml @@ -0,0 +1,57 @@ +# --------------------------------------------------------------------------- +# 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 + secretGithubToken: + required: true + +runs: + using: "composite" + steps: + - name: Generate changelog + uses: ./.github/actions/changelog + with: + token: ${{ inputs.secretGithubToken }} + release_branch: ${{ inputs.branch-ref }} + - name: Commit changelog + 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: Run refresh actions and commit + env: + CI_USER: "github-actions[bot]" + CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com" + run: | + make generate + make update-docs + git add -A && git commit -m 'chore: nightly resource refresh' && echo "refresh=1" >> $GITHUB_ENV || echo "No changes to make update-docs" + - name: Push changes + if: env.changelog == 1 || env.refresh == 1 + env: + CI_USER: "github-actions[bot]" + CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com" + CI_TOKEN: ${{ inputs.secretGithubToken }} + run: | + git push "https://$CI_USER:$CI_TOKEN@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 be6356bb70..0000000000 --- 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_TOKEN@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 0000000000..c5a6278286 --- /dev/null +++ b/.github/workflows/automatic-updates.yml @@ -0,0 +1,73 @@ +# --------------------------------------------------------------------------- +# 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: "Checkout code" + uses: actions/checkout@v2 + with: + ref: main + persist-credentials: false + submodules: recursive + - name: Automatic updates on main + uses: ./.github/actions/automatic-updates + with: + branch-ref: "main" + secretGithubToken: ${{ secrets.GITHUB_TOKEN }} + + v1_10_x: + if: github.repository == 'apache/camel-k' + runs-on: ubuntu-20.04 + steps: + - name: "Checkout code" + uses: actions/checkout@v2 + with: + ref: release-1.10.x + persist-credentials: false + submodules: recursive + - name: Automatic updates on release-1.10.x + uses: ./.github/actions/automatic-updates + with: + branch-ref: "release-1.10.x" + secretGithubToken: ${{ secrets.GITHUB_TOKEN }} + + v1_11_x: + if: github.repository == 'apache/camel-k' + runs-on: ubuntu-20.04 + steps: + - name: "Checkout code" + uses: actions/checkout@v2 + with: + ref: release-1.11.x + persist-credentials: false + submodules: recursive + - name: Automatic updates on release-1.11.x + uses: ./.github/actions/automatic-updates + with: + branch-ref: "release-1.11.x" + secretGithubToken: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file