From b8c38d05cd355d2ad9b594a326036917cb278033 Mon Sep 17 00:00:00 2001 From: "Erik Osterman (CEO @ Cloud Posse)" Date: Wed, 8 May 2024 17:30:47 -0500 Subject: [PATCH] chore: Use GitHub Action Workflows from `cloudposse/.github` Repo (#47) --- .github/configs/draft-release.yml | 54 -------------------- .github/settings.yml | 7 +++ .github/workflows/auto-readme.yml | 75 ---------------------------- .github/workflows/feature-branch.yml | 15 +++--- .github/workflows/main-branch.yaml | 16 ------ .github/workflows/main-branch.yml | 21 ++++++++ .github/workflows/release.yml | 17 ++++--- 7 files changed, 45 insertions(+), 160 deletions(-) delete mode 100644 .github/configs/draft-release.yml create mode 100644 .github/settings.yml delete mode 100644 .github/workflows/auto-readme.yml delete mode 100644 .github/workflows/main-branch.yaml create mode 100644 .github/workflows/main-branch.yml diff --git a/.github/configs/draft-release.yml b/.github/configs/draft-release.yml deleted file mode 100644 index 23df4d7d..00000000 --- a/.github/configs/draft-release.yml +++ /dev/null @@ -1,54 +0,0 @@ -name-template: 'v$RESOLVED_VERSION' -tag-template: '$RESOLVED_VERSION' -version-template: '$MAJOR.$MINOR.$PATCH' -version-resolver: - major: - labels: - - 'major' - minor: - labels: - - 'minor' - - 'enhancement' - patch: - labels: - - 'auto-update' - - 'patch' - - 'fix' - - 'bugfix' - - 'bug' - - 'hotfix' - - 'no-release' - default: 'minor' - -categories: - - title: '🚀 Enhancements' - labels: - - 'enhancement' - - 'patch' - - title: '🐛 Bug Fixes' - labels: - - 'fix' - - 'bugfix' - - 'bug' - - 'hotfix' - - title: '🤖 Automatic Updates' - labels: - - 'auto-update' - -change-template: | -
- $TITLE @$AUTHOR (#$NUMBER) - - $BODY -
- -template: | - $CHANGES - -replacers: - # Remove irrelevant information from Renovate bot - - search: '/(?<=---\s)\s*^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm' - replace: '' - # Remove Renovate bot banner image - - search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm' - replace: '' \ No newline at end of file diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 00000000..882323f4 --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,7 @@ +# Upstream changes from _extends are only recognized when modifications are made to this file in the default branch. +_extends: .github +repository: + name: github-action-matrix-outputs-write + description: Workaround implementation - Write matrix jobs outputs + homepage: https://github.com/community/community/discussions/17245#discussioncomment-3814009 + topics: "" diff --git a/.github/workflows/auto-readme.yml b/.github/workflows/auto-readme.yml deleted file mode 100644 index 1df33d37..00000000 --- a/.github/workflows/auto-readme.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: "auto-readme" -on: - workflow_dispatch: {} - - ## Added pull_request to register workflow from the PR. - ## Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo - pull_request: - branches-ignore: ['*'] - - schedule: - # Example of job definition: - # .---------------- minute (0 - 59) - # | .------------- hour (0 - 23) - # | | .---------- day of month (1 - 31) - # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... - # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat - # | | | | | - # * * * * * user-name command to be executed - - # Update README.md nightly at 4am UTC - - cron: '0 4 * * *' - -jobs: - update: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Find default branch name - id: defaultBranch - shell: bash - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - run: | - default_branch=$(gh repo view --json defaultBranchRef --jq .defaultBranchRef.name) - printf "::set-output name=defaultBranch::%s\n" "${default_branch}" - printf "defaultBranchRef.name=%s\n" "${default_branch}" - - - name: Update readme - shell: bash - id: update - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - DEF: "${{ steps.defaultBranch.outputs.defaultBranch }}" - run: | - make init - make readme/build - # Ignore changes if they are only whitespace - if ! git diff --quiet README.md && git diff --ignore-all-space --ignore-blank-lines --quiet README.md; then - git restore README.md - echo Ignoring whitespace-only changes in README - fi - - - name: Create Pull Request - # This action will not create or change a pull request if there are no changes to make. - # If a PR of the auto-update/readme branch is open, this action will just update it, not create a new PR. - uses: cloudposse/actions/github/create-pull-request@0.33.0 - with: - token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }} - commit-message: Update README.md and docs - title: Update README.md and docs - body: |- - ## what - This is an auto-generated PR that updates the README.md and docs - - ## why - To have most recent changes of README.md and doc from origin templates - - branch: auto-update/readme - base: ${{ steps.defaultBranch.outputs.defaultBranch }} - delete-branch: true - labels: | - auto-update - no-release - readme \ No newline at end of file diff --git a/.github/workflows/feature-branch.yml b/.github/workflows/feature-branch.yml index 7ebd2929..7e956bc4 100644 --- a/.github/workflows/feature-branch.yml +++ b/.github/workflows/feature-branch.yml @@ -1,15 +1,16 @@ name: Feature branch on: pull_request: - branches: [ main ] + branches: + - main + - release/v* types: [opened, synchronize, reopened] +permissions: + contents: write + actions: write + jobs: perform: uses: cloudposse/github-actions-workflows-github-action-composite/.github/workflows/feature-branch.yml@main - with: - organization: "${{ github.event.repository.owner.login }}" - repository: "${{ github.event.repository.name }}" - ref: "${{ github.event.pull_request.head.ref }}" - secrets: - github-private-actions-pat: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}" \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/main-branch.yaml b/.github/workflows/main-branch.yaml deleted file mode 100644 index 21373c69..00000000 --- a/.github/workflows/main-branch.yaml +++ /dev/null @@ -1,16 +0,0 @@ -name: Main branch -on: - push: - branches: [ main ] - -permissions: - contents: write - -jobs: - perform: - uses: cloudposse/github-actions-workflows-github-action-composite/.github/workflows/main-branch.yml@main - with: - organization: "${{ github.event.repository.owner.login }}" - repository: "${{ github.event.repository.name }}" - secrets: - github-private-actions-pat: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/main-branch.yml b/.github/workflows/main-branch.yml new file mode 100644 index 00000000..9620df0a --- /dev/null +++ b/.github/workflows/main-branch.yml @@ -0,0 +1,21 @@ +name: Main branch +on: + push: + branches: + - main + - release/v* + paths-ignore: + - '.github/**' + - 'docs/**' + - 'examples/**' + - 'test/**' + - 'README.md' + +permissions: + contents: write + actions: write + +jobs: + perform: + uses: cloudposse/github-actions-workflows-github-action-composite/.github/workflows/main-branch.yml@main + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9145b73a..aa998581 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,13 @@ -name: Major Release Tagger - +name: Release on: release: - types: - - published + types: [published] + +permissions: + id-token: write + contents: write jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: cloudposse/github-action-major-release-tagger@v1 + perform: + uses: cloudposse/github-actions-workflows-github-action-composite/.github/workflows/release.yml@main + secrets: inherit