You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/07/14 06:37:34 UTC
[camel-k] 02/05: chore(ci): move badge wf into automatic updates
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 888d6c43fdbbb74235f9a555e83597f032bc6a0d
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Fri Jul 14 08:10:48 2023 +0200
chore(ci): move badge wf into automatic updates
---
.github/actions/automatic-updates/action.yml | 37 ++++++++++--
.github/workflows/nightly-coverage.yml | 87 ----------------------------
2 files changed, 33 insertions(+), 91 deletions(-)
diff --git a/.github/actions/automatic-updates/action.yml b/.github/actions/automatic-updates/action.yml
index 43df1ec44..60bcc3a73 100644
--- a/.github/actions/automatic-updates/action.yml
+++ b/.github/actions/automatic-updates/action.yml
@@ -40,6 +40,8 @@ runs:
with:
token: ${{ inputs.secretGithubToken }}
release_branch: ${{ inputs.branch-ref }}
+
+ # Changelog
- name: Commit changelog
shell: bash
env:
@@ -48,7 +50,9 @@ runs:
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"
+ git add CHANGELOG.md && git commit -m 'chore: changelog automatic update' && echo "changelog=1" >> $GITHUB_ENV || echo "No changes to changelog"
+
+ # Autogenerated
- name: Run refresh actions and commit
shell: bash
env:
@@ -56,7 +60,9 @@ runs:
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"
+ git add -A && git commit -m 'chore: autogenerated project resource update' && echo "autogenerated=1" >> $GITHUB_ENV || echo "No changes to autogenerated project resources"
+
+ # SBOM
- name: Generate SBOM
uses: ./.github/actions/gh-go-mod-generate-sbom
with:
@@ -68,10 +74,33 @@ runs:
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"
+ git add camel-k-sbom/camel-k-sbom.json && git commit -m 'chore: nightly SBOM update' && echo "sbom=1" >> $GITHUB_ENV || echo "No changes to SBOM"
+
+ # Coverage badge
+ - name: Go Coverage Badge
+ uses: ./.github/actions/coverage-badge
+ with:
+ filename: coverage.out
+ target: badge.out
+ - name: Convert Badge to adoc
+ run: |
+ replacement=$(grep -o 'https://[^)]*' badge.out)
+ target="(?:https:\/\/img\.shields\.io\/badge\/Coverage).*?(?=\.svg)"
+ perl -i -pe "s|${target}|${replacement}|g" README.adoc
+ - name: Commit changes
+ 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 -A && git commit -m 'chore: nightly coverage badge update' && echo "badge=1" >> $GITHUB_ENV || echo "No changes to coverage badge"
+
+ # Git push
- name: Push changes
shell: bash
- if: env.changelog == 1 || env.refresh == 1 || env.sbom == 1
+ if: env.changelog == 1 || env.autogenerated == 1 || env.sbom == 1 || env.badge == 1
env:
CI_USER: "github-actions[bot]"
CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
diff --git a/.github/workflows/nightly-coverage.yml b/.github/workflows/nightly-coverage.yml
deleted file mode 100644
index 261e3de0e..000000000
--- a/.github/workflows/nightly-coverage.yml
+++ /dev/null
@@ -1,87 +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: coverage
-
-on:
- schedule:
- - cron: '45 1 * * *'
- workflow_dispatch:
-
-jobs:
- test:
- if: github.repository == 'apache/camel-k'
- runs-on: ubuntu-latest
- name: Update Coverage Badge
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- with:
- persist-credentials: false
- fetch-depth: 0
-
- - name: Setup go
- uses: actions/setup-go@v3
- with:
- go-version: '1.18'
- check-latest: true
-
- - uses: actions/cache@v3
- with:
- path: ~/go/pkg/mod
- key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- restore-keys: |
- ${{ runner.os }}-go-
-
- - name: Run Test
- run: |
- go test -v ./... -covermode=count -coverprofile=coverage.out
- go tool cover -func=coverage.out -o=coverage.out
- touch badge.out
-
- - name: Go Coverage Badge
-
- uses: ./.github/actions/coverage-badge
- with:
- filename: coverage.out
- target: badge.out
-
- - name: Convert Badge to adoc
- run: |
- replacement=$(grep -o 'https://[^)]*' badge.out)
- target="(?:https:\/\/img\.shields\.io\/badge\/Coverage).*?(?=\.svg)"
- perl -i -pe "s|${target}|${replacement}|g" README.adoc
-
- - name: Commit changes
- 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 -A && git commit -m 'chore: nightly coverage badge' && echo "refresh=1" >> $GITHUB_ENV || echo "No changes to make update-docs"
-
- - name: Push changes
- shell: bash
- 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: ${{ secrets.GITHUB_TOKEN }}
- run: |
- git push "https://$CI_USER:$CI_TOKEN@github.com/$GITHUB_REPOSITORY.git" '${{ github.ref_name }}'