Skip to content

Commit

Permalink
chore(ci): automatic updates
Browse files Browse the repository at this point in the history
(cherry picked from commit apache/camel-k@a89c28269)
  • Loading branch information
squakez authored and github-actions[bot] committed Dec 19, 2022
1 parent 6245782 commit 3e93dea
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 60 deletions.
57 changes: 57 additions & 0 deletions .github/actions/automatic-updates/action.yml
Original file line number Diff line number Diff line change
@@ -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 }}
60 changes: 0 additions & 60 deletions .github/workflows/automatic-changelog-update.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/automatic-updates.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 3e93dea

Please sign in to comment.