blob: 27c5daa87dc7f2374212f1ab58a1e6b46d6132f1 [file] [log] [blame]
# ---------------------------------------------------------------------------
# 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
goVersion:
required: true
type: string
runs:
using: "composite"
steps:
- name: Install Go ${{ inputs.goVersion }}
uses: actions/setup-go@v2
with:
go-version: ${{ inputs.goVersion }}
- name: Generate changelog
uses: ./.github/actions/changelog
with:
token: ${{ inputs.secretGithubToken }}
release_branch: ${{ inputs.branch-ref }}
- name: Commit changelog
shell: bash
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
shell: bash
env:
CI_USER: "github-actions[bot]"
CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
run: |
make update-default-camel generate codegen 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: Generate SBOM
uses: ./.github/actions/gh-go-mod-generate-sbom
with:
version: v1
args: mod -licenses -json -output camel-k-sbom/camel-k-sbom.json
- name: Commit SBOM
shell: bash
env:
CI_USER: "github-actions[bot]"
CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
run: |
git add camel-k-sbom/camel-k-sbom.json && git commit -m 'chore: nightly SBOM refresh' && echo "sbom=1" >> $GITHUB_ENV || echo "No changes to SBOM"
- name: Push changes
shell: bash
if: env.changelog == 1 || env.refresh == 1 || env.sbom == 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 }}