Skip to content

Commit b1a799e

Browse files
authored
Merge pull request #38 from devlinjunker/release-0.5
release-0.5
2 parents abd1649 + 52486af commit b1a799e

20 files changed

+64
-8
lines changed

.github/workflows/auto-label.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ jobs:
3030

3131
- name: Remove WIP Status Label
3232
if: github.event.action == 'closed'
33-
uses: actions-ecosystem/action-remove-labels@v1.1.0
33+
uses: actions-ecosystem/action-remove-labels@v1.1.1
3434
continue-on-error: true
3535
with:
3636
github_token: ${{ secrets.github_token }}
3737
labels: "status: WIP"
3838

3939
- name: Remove Blocked Status Label
4040
if: github.event.action == 'closed'
41-
uses: actions-ecosystem/action-remove-labels@v1.1.0
41+
uses: actions-ecosystem/action-remove-labels@v1.1.1
4242
continue-on-error: true
4343
with:
4444
github_token: ${{ secrets.github_token }}

.github/workflows/release-on-merge.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
push:
1010
branches:
1111
- release-*
12+
paths-ignore:
13+
- 'README.md' # ignore changes to README as we edit this when creating release branch
1214

1315
jobs:
1416
create-release-tag:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Version: 0.4.0
2+
Version: 0.5.0
33
---
44

55
# Example - CII 100%

scripts/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Script Files
2+
This directory contains script files to help with developer workflows, for now these are shell scripts. But if desired, we could replace these with node or python scripts instead.
3+
4+
## Conventions
5+
- Add `set -eu` to top of shell scripts when possible
6+
- `set -e` causes the script to exit if any errors occur
7+
- `set -u` causes the script to error if any undeclared variables are encountered
8+
- Linting with [Shellcheck] for ideal formatting to prevent errors
9+
- Unit Testing with [BATS] (Bash Automatic Testing System)
10+
- Ideally wrap code in `main` method and then invoke at the end of script
11+
12+
13+
[ShellCheck]: https://www.shellcheck.net/
14+
[BATS]: https://bats-core.readthedocs.io/

scripts/bin/lint.sh

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#! /bin/bash
22

3+
# cannot `set -u` here because `if [[ -z "$BATS_TMPDIR" ]];` errors
4+
## if we enforce bash version 4.2 then we can use `if [ -v BATS_TMPDIR ]` to check
5+
## and then can `set -u` here
6+
set -e
7+
38
DIR=$(dirname "$0")
49

510
lint_scripts() {

scripts/bin/test.sh

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#! /bin/bash
22

3+
# cannot `set -u` here because `if [[ -z "$BATS_TMPDIR" ]];` errors
4+
## if we enforce bash version 4.2 then we can use `if [ -v BATS_TMPDIR ]` to check
5+
## and then can `set -u` here
6+
set -e
7+
38
DIR=$(dirname "$0")
49

510
find_script_test() {

scripts/hooks/commit-msg.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#! /bin/bash
22
# Script to verify that commit message matches conventions
33

4+
set -eu
5+
46
# set directory for calling other scripts
57
DIR=$(dirname "${BASH_SOURCE[0]}")
68
# if in hook, then prep PATH to find in repo `scripts/hooks/` dir

scripts/hooks/internal/branch-name.sh

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#
77
# based on https://itnext.io/using-git-hooks-to-enforce-branch-naming-policy-ffd81fa01e5e
88

9+
set -eu
910

1011
# set directory for calling other scripts
1112
# NOTE: expect this to be called in this directory

scripts/hooks/internal/branch-protections.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#! /bin/bash
22
# Script to check github branch protections and prevent commits to protected branches
33

4+
set -eu
5+
46
BLOCKED_BRANCH=( main develop )
57
BLOCKED_PREFIX=( release )
68

@@ -39,9 +41,9 @@ github() {
3941

4042
main() {
4143

42-
# check github branch protections
43-
github
44-
44+
# TODO: check github branch protections (skipping for now as it errors during testing)
45+
# github
46+
4547
# compare against branch name/prefixes defined in here
4648
if [[ "${BLOCKED_BRANCH[*]}" =~ $BRANCH ]]; then
4749
return 1;

scripts/hooks/internal/prefix-list.sh

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#! /bin/bash
22

3+
# cannot `set -u` here because `if [ -z "$BATS_PREFIX_LIST" ];` errors
4+
## if we enforce bash version 4.2 then we can use `if [ -v BATS_PREFIX_LIST ]` to check
5+
## and then can `set -u` here
6+
set -e
7+
38
OTHER_TYPES=( 'feat' 'fix' 'bugfix' 'perf' 'test' )
49

510
# set directory for calling other scripts

scripts/hooks/post-commit.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#! /bin/bash
22
# Checks that the git diff is not getting to big and warns if it is
33

4+
set -eu
45

56
# TODO: better way to determine the branch/commit we want to check against?
67
# for now look back until DIFF_BRANCH and find other merge commits -- those with (#..) in the commit message

scripts/hooks/pre-commit.sh

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Pre-commit githook to run before every commit to validate it locally
33
# 1. Check that branch name matches conventions (branch-name.sh)
44

5+
set -eu
6+
57
# set directory for calling other scripts
68
DIR=$(dirname "${BASH_SOURCE[0]}")
79

scripts/hooks/pre-push.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#! /bin/bash
22

3+
set -eu
4+
35
# set directory for calling other scripts
46
DIR=$(dirname "${BASH_SOURCE[0]}")
57

scripts/release/patch-cut-check.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#! /bin/bash
22

3+
set -eu
4+
35
if [[ "$1" != "main" && "$1" != "release-"* ]]; then
46
echo "::error::Cannot Cut Patch off of non 'release-*' or 'main' branch";
57
exit 1

scripts/release/release-cut-check.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#! /bin/bash
22

3+
set -eu
34

45
if git branch -a | grep "$RELEASE_BRANCH"; then
56
echo "::error::Release Branch Already Exists";

scripts/release/release-prep-upmerge.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#! /bin/bash
22

3+
set -eu
4+
35
git checkout develop;
46

57
# Get version in `develop` (We wantt this to be version in the final README)
68
# VERSION=$(less README.md | head -n 3);
79

810
# upmerge from branch input
911
git pull;
10-
git merge "$1";
12+
git merge "$1" 2>/dev/null; # ignore error we expect here
1113

1214
# TODO: Resolve conflicts better (maybe https://github.com/jakub-g/git-resolve-conflict)
1315
git reset README.md;

scripts/release/update-versions.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#! /bin/bash
22
# Open Versioned files in repo and increment version
33

4-
if [ -z "$1" ]; then
4+
set -eu
5+
6+
# check number of arguments first so we don't access unset variable and error with set -u
7+
if [[ $# == 0 || -z "$1" ]]; then
58
echo "Error: no version number"
69
exit 1;
710
fi;

scripts/workflows/branch-match.sh

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#! /bin/bash
2+
3+
set -eu
4+
25
## Verify that BRANCH matches regexp, else error
36
if [[ ! $BRANCH =~ $REGEXP ]]; then
47
exit 1;

scripts/workflows/collect-wiki.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#! /bin/bash
22

3+
set -eu
4+
35
mkdir wiki
46

57
# create `.README` file with Table of Contents to link to each

scripts/workflows/verify-merge.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#! /bin/bash
22
# Verify that a branch can be merged
33

4+
set -eu
5+
46
# check branch type prefix != "poc"
57

68
if [[ "$BRANCH" =~ "poc/" ]]; then

0 commit comments

Comments
 (0)