Skip to content

Commit

Permalink
Merge pull request #34 from devlinjunker/release-0.4
Browse files Browse the repository at this point in the history
release-0.4
  • Loading branch information
devlinjunker authored Jul 18, 2021
2 parents 545b96a + 31d0cca commit abd1649
Show file tree
Hide file tree
Showing 34 changed files with 403 additions and 130 deletions.
10 changes: 6 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Description: <!-- Quickly describe what you are solving and how -->
**Description:** <!-- Quickly describe what you are solving and how -->

# Related: <!-- Links to Related issues or documentation/references used for this change -->
**Related:** <!-- Links to Related issues or documentation/references used for this change -->

# Visual: <!-- Add a screenshot! -->
**Visual:** <!-- Add a screenshot! -->

# TODO:
**Tests:** <!-- Explain Testing done or why testing is not needed -->

**TODO:**
- [ ] Updated README documents
- [ ] Complete PR Body
10 changes: 9 additions & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,18 @@ This directory contains files related to Github configurations and actions:
- Creates a new `patch-*` branch off of `main`, using the last tag to determine hotfix branch number and next version number


### PR Landmine Action (landmine.yaml)
- Runs when comment on PR, starting with :bomb: and containing [suggestion syntax](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)
- Suggestion should check if tests will catch error caused by change
- If the suggestion is bad, you should be able to edit the suggestion and comment on the thread to re-run the action

### On Merge to `release-*` action (release-on-merge.yaml)
- Creates new Release Tag and Github Release on `relesae-*` branch


## Ideas
- [ ] pr mutation testing: https://github.com/tylermurry/github-pr-landmine
- [x] pr mutation testing: https://github.com/tylermurry/github-pr-landmine
- This is a Github App that is enabled in each repo
- [x] build docs on merge to `main`
- [ ] build artifacts on release (merge to `main`)
- [ ] run build/compile in `develop-verify-merge.yaml` to ensure PR is valid
12 changes: 8 additions & 4 deletions .github/workflows/auto-label.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Name should reflect when action occurs
## This action automatically handles PR labels with:
## - On PR opened, label based on pr-branch-labeler.yml
## - On PR closed, remove WIP or blocked labels
## - On commit added, if message contains 'wip' then add WIP label

name: Auto Label PR

on:
Expand Down Expand Up @@ -26,15 +30,15 @@ jobs:

- name: Remove WIP Status Label
if: github.event.action == 'closed'
uses: actions-ecosystem/action-remove-labels@v1
uses: actions-ecosystem/action-remove-labels@v1.1.0
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
labels: "status: WIP"

- name: Remove Blocked Status Label
if: github.event.action == 'closed'
uses: actions-ecosystem/action-remove-labels@v1
uses: actions-ecosystem/action-remove-labels@v1.1.0
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
Expand All @@ -56,7 +60,7 @@ jobs:
- name: Add WIP Label if wip commit msg
if: startsWith(steps.commit.outputs.msg, 'wip') && github.event.action == 'synchronize'
uses: actions-ecosystem/action-add-labels@v1
uses: actions-ecosystem/action-add-labels@v1.1.2
with:
github_token: ${{ secrets.github_token }}
labels: "status: wip"
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/develop-verify-merge.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Name should reflect when action occurs
## This Action verifieds that PRs against 'develop' branch can be merged
## - Do not allow branches with `poc/` or `wip/` to be merged
## - Ensure PR title matches the branch prefix

name: Develop-Verify Merge

on:
Expand Down Expand Up @@ -35,11 +38,11 @@ jobs:
uses: deepakputhraya/action-pr-title@master
with:
regex: '(\([\w\s]*\)*\))?:[\w\s]*'
allowed_prefixes: ${{ steps.extract_branch.outputs.prefix }}
allowed_prefixes: ${{ steps.extract_branch.outputs.prefix }},build # add build to not fail dependabot PRs
prefix_case_sensitive: true

- name: "Verify BATS Tests Pass"
run: 'scripts/bin/test.sh'

- name: "Lint with Shellcheck"
run: 'scripts/bin/lint.sh'
run: 'scripts/bin/lint.sh'
30 changes: 30 additions & 0 deletions .github/workflows/landmine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: PR Landmine

on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
pull_request_review:
types:
- submitted
- edited
- dismissed

jobs:
landmine:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: PR Landmine
uses: tylermurry/github-pr-landmine@v1
with:
token: ${{ github.token }}
test-command: ./scripts/bin/test.sh

25 changes: 21 additions & 4 deletions .github/workflows/main-on-merge.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## This Action is run when a commit is made to the main branch (ideally a PR merge)
## - Collects READMEs for Github Wiki
## - Creates Github Release (with codebase after commit) and Git Tag
## - Creates Changelog for Release
## - Upmerges branch to develop (so any changes that were made in release branch are in develop)

name: "Release-Tag"

on:
Expand All @@ -14,7 +20,7 @@ jobs:
- name: Collect READMEs for Wiki
run: ./scripts/workflows/collect-wiki.sh

# from: https://github.com/marketplace/actions/wiki-page-creator-action
# from: https://github.com/marketplace/actions/wiki-page-creator-action
- name: Upload READMEs to Wiki
uses: docker://decathlon/wiki-page-creator-action:latest
env:
Expand All @@ -31,6 +37,11 @@ jobs:
max-parallel: 1
runs-on: ubuntu-latest

outputs:
major: ${{ steps.version.outputs.major }}
minor: ${{ steps.version.outputs.minor }}
patch: ${{ steps.version.outputs.patch }}

steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -72,20 +83,26 @@ jobs:
strategy:
max-parallel: 1
runs-on: ubuntu-latest
needs: create-release-tag

steps:
- uses: actions/checkout@v2
with:
## This is a Personal Access Token from Admin User that allows us to bypass branch protections on develop
token: ${{ secrets.PAT }}
fetch-depth: 0

- name: Upmerge develop After Release
run: |
git config --global user.name 'Release Cut';
git config --global user.email '[email protected]';
./scripts/release/release-prep-upmerge.sh
./scripts/release/release-prep-upmerge.sh main
git commit -m "upmerge after $RELEASE";
git push;
git checkout $RELEASE_BRANCH;
git pull;
git merge main;
git push;
env:
RELEASE: v${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}
RELEASE: v${{ needs.create-release-tag.outputs.major }}.${{ needs.create-release-tag.outputs.minor }}.${{ needs.create-release-tag.outputs.patch }}
RELEASE_BRANCH: release-${{ needs.create-release-tag.outputs.major }}.${{ needs.create-release-tag.outputs.minor }}
6 changes: 5 additions & 1 deletion .github/workflows/main-verify-merge.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## This Action verifieds that PRs against 'main' branch can be merged
## - Only can be merged from `patch-*` or `release-*` branch
## - PR title should either be `patch-*` or `release-*`

name: "Main-Verify Merge PR"

on:
Expand Down Expand Up @@ -32,4 +36,4 @@ jobs:
run: 'scripts/bin/test.sh'

- name: "Lint with Shellcheck"
run: 'scripts/bin/lint.sh'
run: 'scripts/bin/lint.sh'
3 changes: 2 additions & 1 deletion .github/workflows/manage-labels.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Name should reflect when action occurs
## This Action is run to ensure that the only labels in the Github Repo are the ones defined in .github/labels.yaml

name: Manage Labels

# Controls when the action will run. Workflow runs when manually triggered using the UI
Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/patch-cut.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## This Action creates a new 'patch-*' branch with the next semantic version number
## - Manually run by developer wiht input of branch to patch off of
## - must be created off of `main` or `release-*` branch
## - creates a PR against the branch it was cut off of

name: "Patch-Cut"

# Workflow runs when manually triggered using the UI or API
Expand All @@ -14,10 +19,16 @@ jobs:
token: ${{ secrets.PAT }}
fetch-depth: 0

- name: "Error if not in main or release branch"
id: branch
run: |
./scripts/release/patch-cut-check.sh ${GITHUB_REF##*/};
echo "##[set-output name=release;]${GITHUB_REF##*/}";
- name: "Get Version Info"
id: version
run: |
git checkout main;
git fetch --all --tags;
cd scripts/release;
unzip git-mkver-linux.zip;
cd ../..;
Expand All @@ -44,3 +55,14 @@ jobs:
env:
PATCH_BRANCH: patch-${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.next_version.outputs.patch }}
PATCH_VERSION: ${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.next_version.outputs.patch }}

# Note: see https://github.com/repo-sync/pull-request#advanced-options for all options
- name: Create Patch Pull Request
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.PAT }}
source_branch: patch-${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.next_version.outputs.patch }}
destination_branch: ${{ steps.branch.outputs.release }}
pr_title: patch-${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.next_version.outputs.patch }}
pr_body: ${{ steps.version.outputs.changelog }}
pr_label: "- release -"
4 changes: 4 additions & 0 deletions .github/workflows/release-cut.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## This Action creates a `release-*` branch off of the `main` branch
## - The new `release-*` branch will match the next semantic version (based on git tags)

name: "Release-Cut"

# Workflow runs when manually triggered using the UI or API
Expand All @@ -20,6 +23,7 @@ jobs:
- name: "Get Release Info"
id: version
run: |
git fetch --all --tags;
git checkout main;
git checkout develop;
cd scripts/release;
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/release-on-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
## This action is run when a commit is made to a `release-*` branch (ideally from patch-* PR)
## - Creates Github Release (with codebase after commit) and Git Tag
## - Creates Changelog for Release
## - Upmerges branch to develop (so any changes that were made in release branch are in develop)

name: "Release-Merge"

on:
push:
branches:
- release-*

jobs:
create-release-tag:
strategy:
max-parallel: 1
runs-on: ubuntu-latest

outputs:
major: ${{ steps.version.outputs.major }}
minor: ${{ steps.version.outputs.minor }}
patch: ${{ steps.version.outputs.patch }}
found: ${{ steps.check_release.outputs.found }}
release-commit: ${{ steps.check_release.outputs.release-commit }}
main-commit: ${{ steps.check_release.outputs.main-commit }}

steps:
- uses: actions/checkout@v2
with:
## This is a Personal Access Token from Admin User that allows us to bypass branch protections on develop
token: ${{ secrets.PAT }}
fetch-depth: 0

# NOTE: Update CHANGELOG_PREFIX_LIST to configure the lines you wan to include in the changelog (body of release PR)
- name: "Get Release Info"
id: version
run: |
git fetch --all --tags;
git checkout ${GITHUB_REF##*/};
cd scripts/release;
unzip git-mkver-linux.zip;
cd ../..;
echo "##[set-output name=major;]$(./scripts/release/git-mkver-linux next --format '{Major}')";
echo "##[set-output name=minor;]$(./scripts/release/git-mkver-linux next --format '{Minor}')";
echo "##[set-output name=patch;]$(./scripts/release/git-mkver-linux next --format '{Patch}')";
CHANGELOG=$(git log --format=%s $(git describe --tags --abbrev=0)..HEAD | grep -i -E "^($CHANGELOG_PREFIX_LIST)" | sed "s/^/ - /")
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
echo "##[set-output name=changelog;]$(echo $CHANGELOG)";
env:
CHANGELOG_PREFIX_LIST: "feature|feat|fix|bugfix|bug"

- name: Check Create Release
id: check_release
run: |
git checkout main;
echo "##[set-output name=found;]$(git log | grep ${GITHUB_REF##*/})";
echo "##[set-output name=main-commit;]$(git log --oneline main | awk '{if (NR == 1) commit=$1 } END { print commit }')";
echo "##[set-output name=release-commit;]$(git log --oneline ${GITHUB_REF##*/} | awk '{if (NR == 1) commit=$1 } END { print commit }')";
git checkout ${GITHUB_REF}
- name: Create Github Release
id: create_release
uses: actions/create-release@v1
if: steps.check_release.outputs.found != '' && steps.check_release.outputs.release-commit != steps.check_release.outputs.main-commit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}
release_name: release-${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}
body: ${{ steps.version.outputs.changelog }}

upmerge-after-release:
strategy:
max-parallel: 1
runs-on: ubuntu-latest
needs: create-release-tag

steps:
- uses: actions/checkout@v2
with:
## This is a Personal Access Token from Admin User that allows us to bypass branch protections on develop
token: ${{ secrets.PAT }}
fetch-depth: 0

- name: Upmerge develop After Release
if: needs.create-release-tag.outputs.found != '' && needs.create-release-tag.outputs.release-commit != needs.create-release-tag.outputs.main-commit
run: |
git config --global user.name 'Release Cut';
git config --global user.email '[email protected]';
./scripts/release/release-prep-upmerge.sh ${GITHUB_REF##*/}
git commit -m "upmerge after $RELEASE";
git push;
env:
RELEASE: v${{ needs.create-release-tag.outputs.major }}.${{ needs.create-release-tag.outputs.minor }}.${{ needs.create-release-tag.outputs.patch }}
Loading

0 comments on commit abd1649

Please sign in to comment.