From 784bf0dd203ccd3bc5d02eb78ca787c7ab305e11 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger <43503240+paullatzelsperger@users.noreply.github.com> Date: Thu, 6 Jul 2023 14:02:48 +0200 Subject: [PATCH] chore: reformat workflow yaml files (#578) --- .github/workflows/draft-new-release.yaml | 34 ++++------- .github/workflows/helm-lint.yaml | 70 +++++++++++------------ .github/workflows/kics.yml | 4 +- .github/workflows/publish-new-release.yml | 51 ++++++----------- .github/workflows/verify.yaml | 2 +- 5 files changed, 66 insertions(+), 95 deletions(-) diff --git a/.github/workflows/draft-new-release.yaml b/.github/workflows/draft-new-release.yaml index fc99b6326..b374649dd 100644 --- a/.github/workflows/draft-new-release.yaml +++ b/.github/workflows/draft-new-release.yaml @@ -38,56 +38,46 @@ jobs: pull-requests: write steps: - uses: actions/checkout@v3.5.2 - - - name: Create release branch + - name: Create release branch run: git checkout -b release/${{ github.event.inputs.version }} - - - name: Update changelog + - name: Update changelog uses: thomaseizinger/keep-a-changelog-new-release@1.3.0 with: tag: ${{ github.event.inputs.version }} - - - name: Initialize mandatory git config + - name: Initialize mandatory git config run: | git config user.name "eclipse-tractusx-bot" git config user.email "tractusx-bot@eclipse.org" - - - uses: ./.github/actions/setup-java - - - name: Bump version in gradle.properties + - uses: ./.github/actions/setup-java + - name: Bump version in gradle.properties run: |- - # replace the project's (default) version, could be overwritten later with the -Pversion=... flag - sed -i 's/version=.*/version=${{ github.event.inputs.version }}/g' gradle.properties + # replace the project's (default) version, could be overwritten later with the -Pversion=... flag + sed -i 's/version=.*/version=${{ github.event.inputs.version }}/g' gradle.properties env: GITHUB_PACKAGE_USERNAME: ${{ github.actor }} GITHUB_PACKAGE_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - - - name: Bump version in /charts + - name: Bump version in /charts uses: mikefarah/yq@v4.34.1 with: cmd: |- find charts -name Chart.yaml -maxdepth 3 | xargs -n1 yq -i '.appVersion = "${{ github.event.inputs.version }}" | .version = "${{ github.event.inputs.version }}"' - - - name: Update Chart READMEs + - name: Update Chart READMEs uses: addnab/docker-run-action@v3 with: image: jnorwood/helm-docs:v1.10.0 options: -v ${{ github.workspace }}/charts:/helm-docs run: | helm-docs --log-level debug - - - name: Commit changelog and manifest files + - name: Commit changelog and manifest files id: make-commit run: | git add CHANGELOG.md gradle.properties $(find charts -name Chart.yaml) $(find charts -name README.md) git commit --message "Prepare release ${{ github.event.inputs.version }}" echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - - name: Push new branch + - name: Push new branch run: git push origin release/${{ github.event.inputs.version }} - - - name: Create pull request + - name: Create pull request uses: thomaseizinger/create-pull-request@1.3.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/helm-lint.yaml b/.github/workflows/helm-lint.yaml index 9bd8bc0ab..37cdb0c3d 100644 --- a/.github/workflows/helm-lint.yaml +++ b/.github/workflows/helm-lint.yaml @@ -41,41 +41,35 @@ jobs: helm-lint: runs-on: ubuntu-latest steps: - ############## - ### Set-Up ### - ############## - - - uses: actions/checkout@v3.5.2 - with: - fetch-depth: 0 - - - name: helm (setup) - uses: azure/setup-helm@v3.5 - with: - version: v3.8.1 - - - name: python (setup) - uses: actions/setup-python@v4 - with: - python-version: 3.7 - - - name: chart-testing (setup) - uses: helm/chart-testing-action@v2.4.0 - ##################### - ### Chart Testing ### - ##################### - - - name: chart-testing (list-changed) - id: list-changed - run: | - changed=$(ct list-changed --config ct.yaml --target-branch main) - if [[ -n "$changed" ]]; then - echo "changed=true" >> $GITHUB_OUTPUT - fi - - - name: chart-testing (lint) - if: steps.list-changed.outputs.changed == 'true' - run: | - ct lint \ - --config ct.yaml \ - --all + ############## + ### Set-Up ### + ############## + - uses: actions/checkout@v3.5.2 + with: + fetch-depth: 0 + - name: helm (setup) + uses: azure/setup-helm@v3.5 + with: + version: v3.8.1 + - name: python (setup) + uses: actions/setup-python@v4 + with: + python-version: 3.7 + - name: chart-testing (setup) + uses: helm/chart-testing-action@v2.4.0 + ##################### + ### Chart Testing ### + ##################### + - name: chart-testing (list-changed) + id: list-changed + run: | + changed=$(ct list-changed --config ct.yaml --target-branch main) + if [[ -n "$changed" ]]; then + echo "changed=true" >> $GITHUB_OUTPUT + fi + - name: chart-testing (lint) + if: steps.list-changed.outputs.changed == 'true' + run: | + ct lint \ + --config ct.yaml \ + --all diff --git a/.github/workflows/kics.yml b/.github/workflows/kics.yml index adb020c1f..c276bad00 100644 --- a/.github/workflows/kics.yml +++ b/.github/workflows/kics.yml @@ -22,9 +22,9 @@ name: "KICS" on: push: - branches: [main, releases] + branches: [ main, releases ] pull_request: - branches: [main, releases] + branches: [ main, releases ] workflow_dispatch: schedule: diff --git a/.github/workflows/publish-new-release.yml b/.github/workflows/publish-new-release.yml index e97bd0db7..9ab9964fb 100644 --- a/.github/workflows/publish-new-release.yml +++ b/.github/workflows/publish-new-release.yml @@ -36,24 +36,21 @@ jobs: outputs: RELEASE_VERSION: ${{ steps.release-version.outputs.RELEASE_VERSION }} steps: - - - name: Extract version from branch name (for release branches) + - name: Extract version from branch name (for release branches) if: startsWith(github.event.pull_request.head.ref, 'release/') run: | BRANCH_NAME="${{ github.event.pull_request.head.ref }}" VERSION=${BRANCH_NAME#release/} echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV - - - name: Extract version from branch name (for hotfix branches) + - name: Extract version from branch name (for hotfix branches) if: startsWith(github.event.pull_request.head.ref, 'hotfix/') run: | BRANCH_NAME="${{ github.event.pull_request.head.ref }}" VERSION=${BRANCH_NAME#hotfix/} echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV - - - name: Output release version + - name: Output release version id: release-version run: | echo "RELEASE_VERSION=${{ env.RELEASE_VERSION }}" >> $GITHUB_OUTPUT @@ -102,12 +99,12 @@ jobs: strategy: fail-fast: false matrix: - variant: [{dir: edc-controlplane, img: edc-runtime-memory}, - {dir: edc-controlplane, img: edc-controlplane-memory-hashicorp-vault}, - {dir: edc-controlplane, img: edc-controlplane-postgresql-hashicorp-vault}, - {dir: edc-controlplane, img: edc-controlplane-postgresql-azure-vault}, - {dir: edc-dataplane, img: edc-dataplane-azure-vault}, - {dir: edc-dataplane, img: edc-dataplane-hashicorp-vault}] + variant: [ { dir: edc-controlplane, img: edc-runtime-memory }, + { dir: edc-controlplane, img: edc-controlplane-memory-hashicorp-vault }, + { dir: edc-controlplane, img: edc-controlplane-postgresql-hashicorp-vault }, + { dir: edc-controlplane, img: edc-controlplane-postgresql-azure-vault }, + { dir: edc-dataplane, img: edc-dataplane-azure-vault }, + { dir: edc-dataplane, img: edc-dataplane-hashicorp-vault } ] steps: - uses: actions/checkout@v3.5.2 @@ -136,21 +133,17 @@ jobs: if: github.event.pull_request.merged == true && needs.release-version.outputs.RELEASE_VERSION steps: - - - name: Export RELEASE_VERSION env + - name: Export RELEASE_VERSION env run: | echo "RELEASE_VERSION=${{ needs.release-version.outputs.RELEASE_VERSION }}" >> $GITHUB_ENV - - - uses: actions/checkout@v3.5.2 + - uses: actions/checkout@v3.5.2 with: fetch-depth: 0 - - - name: Install Helm + - name: Install Helm uses: azure/setup-helm@v3.5 with: version: v3.8.1 - - - name: Package helm, update index.yaml and push to gh-pages + - name: Package helm, update index.yaml and push to gh-pages run: | # Prepare git env git config user.name "eclipse-tractusx-bot" @@ -183,17 +176,14 @@ jobs: pull-requests: write if: github.event.pull_request.merged == true && needs.release-version.outputs.RELEASE_VERSION steps: - - - name: Export RELEASE_VERSION env + - name: Export RELEASE_VERSION env run: | echo "RELEASE_VERSION=${{ needs.release-version.outputs.RELEASE_VERSION }}" >> $GITHUB_ENV - - - uses: actions/checkout@v3.5.2 + - uses: actions/checkout@v3.5.2 with: # 0 to fetch the full history due to upcoming merge of releases into main branch fetch-depth: 0 - - - name: Create Release Tag + - name: Create Release Tag id: create_release_tag run: | # Prepare git env @@ -207,8 +197,7 @@ jobs: # Create & push tag git tag --force ${{ env.RELEASE_VERSION }} git push --force origin ${{ env.RELEASE_VERSION }} - - - name: Create Github Release + - name: Create Github Release id: create_release uses: thomaseizinger/create-release@1.0.0 env: @@ -219,10 +208,8 @@ jobs: name: ${{ env.RELEASE_VERSION }} draft: false prerelease: false - - - uses: ./.github/actions/setup-java - - - name: Merge releases back into main and set new snapshot version + - uses: ./.github/actions/setup-java + - name: Merge releases back into main and set new snapshot version if: github.event.pull_request.base.ref == 'releases' run: | # Prepare git env diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index 8aa69e4bf..e5e25a6a7 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -70,7 +70,7 @@ jobs: - uses: ./.github/actions/setup-java - name: Download latest Eclipse Dash run: | - curl -L https://repo.eclipse.org/service/local/artifact/maven/redirect\?r\=dash-licenses\&g\=org.eclipse.dash\&a\=org.eclipse.dash.licenses\&v\=LATEST --output dash.jar + curl -L https://repo.eclipse.org/service/local/artifact/maven/redirect\?r\=dash-licenses\&g\=org.eclipse.dash\&a\=org.eclipse.dash.licenses\&v\=LATEST --output dash.jar - name: Regenerate DEPENDENCIES run: | # dash returns a nonzero exit code if there are libs that need review. the "|| true" avoids that