Skip to content

Commit c8a95d0

Browse files
Merge pull request #10 from CodeForPhilly/develop
Release: v1.0.1
2 parents c3dddb9 + 16ce67f commit c8a95d0

File tree

17 files changed

+454
-5
lines changed

17 files changed

+454
-5
lines changed

.github/workflows/publish-docs.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Publish Docs
2+
3+
on:
4+
push:
5+
branches: [ develop ]
6+
7+
jobs:
8+
9+
publish-docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
13+
- name: 'Update holobranch: gh-pages'
14+
uses: JarvusInnovations/hologit@actions/projector/v1
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
HAB_LICENSE: accept
18+
with:
19+
holobranch: docs-site
20+
commit-to: gh-pages
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Publish Holobranches
2+
3+
on:
4+
push:
5+
tags: [ 'v1.*' ]
6+
7+
jobs:
8+
9+
publish-holobranches:
10+
runs-on: ubuntu-latest
11+
steps:
12+
13+
- name: 'Update holobranch: emergence/site/v1'
14+
uses: JarvusInnovations/hologit@actions/projector/v1
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
HAB_LICENSE: accept
18+
with:
19+
holobranch: emergence-site
20+
commit-to: emergence/site/v1

.github/workflows/release-deploy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 'Release: Deploy PR'
2+
3+
on:
4+
pull_request:
5+
branches: [ 'releases/v*' ]
6+
types: [ closed ]
7+
8+
jobs:
9+
release-deploy:
10+
11+
if: github.event.pull_request.merged == true # only run on PR merge
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- name: Configure release
16+
run: |
17+
PR_TITLE=$(jq -r ".pull_request.title" $GITHUB_EVENT_PATH)
18+
PR_BODY=$(jq -r ".pull_request.body" $GITHUB_EVENT_PATH)
19+
RELEASE_TAG=$(echo "${PR_TITLE}" | grep -oP "(?<=^Release: )v\d+\.\d+\.\d+(-rc\.\d+)?$")
20+
21+
if [[ "${RELEASE_TAG}" =~ -rc\.[0-9]+$ ]]; then
22+
RELEASE_PRERELEASE=true
23+
else
24+
RELEASE_PRERELEASE=false
25+
fi
26+
27+
echo "PR_TITLE=${PR_TITLE}" >> $GITHUB_ENV
28+
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
29+
echo "RELEASE_PRERELEASE=${RELEASE_PRERELEASE}" >> $GITHUB_ENV
30+
31+
echo 'PR_BODY<<END_OF_PR_BODY' >> $GITHUB_ENV
32+
echo "${PR_BODY}" >> $GITHUB_ENV
33+
echo 'END_OF_PR_BODY' >> $GITHUB_ENV
34+
35+
- name: Create release
36+
uses: ncipollo/release-action@v1
37+
with:
38+
token: ${{ secrets.BOT_GITHUB_TOKEN }}
39+
commit: '${{ github.sha }}'
40+
tag: '${{ env.RELEASE_TAG }}'
41+
body: '${{ env.PR_BODY }}'
42+
draft: false
43+
prerelease: ${{ env.RELEASE_PRERELEASE }}

.github/workflows/release-prepare.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: 'Release: Prepare PR'
2+
3+
on:
4+
push:
5+
branches: [ develop ]
6+
7+
env:
8+
GITHUB_USERNAME: codeforphilly-bot
9+
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
10+
RELEASE_BRANCH: releases/v1
11+
12+
jobs:
13+
release-prepare:
14+
15+
runs-on: ubuntu-latest
16+
steps:
17+
18+
- uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
21+
22+
# - uses: mxschmitt/action-tmate@v3
23+
24+
- name: Create/update pull request
25+
run: |
26+
# get latest release tag
27+
latest_release=$(git describe --tags --abbrev=0 "origin/${RELEASE_BRANCH}")
28+
latest_release_bumped=$(echo $latest_release | awk -F. -v OFS=. '{$NF++;print}')
29+
30+
31+
# create or update PR
32+
pr_body="$(cat <<EOF
33+
Release: ${latest_release_bumped}
34+
35+
## Improvements
36+
37+
## Technical
38+
39+
EOF
40+
)"
41+
42+
pr_number=$(hub pr list -h develop -f '%I')
43+
44+
if [ -n "${pr_number}" ]; then
45+
echo "Updating PR #${pr_number}"
46+
existing_comment_id=$(hub api "/repos/${GITHUB_REPOSITORY}/issues/${pr_number}/comments" | jq '.[] | select(.user.login=="${GITHUB_USERNAME}") | .id')
47+
else
48+
echo "Opening PR"
49+
hub pull-request -b "${RELEASE_BRANCH}" -h develop -F <(echo "${pr_body}") > /tmp/pr.json
50+
pr_number=$(hub pr list -h develop -f '%I')
51+
echo "Opened PR #${pr_number}"
52+
fi
53+
54+
55+
# build changelog
56+
commits=$(
57+
git log \
58+
--first-parent \
59+
--reverse \
60+
--format="%H" \
61+
"origin/${RELEASE_BRANCH}..develop"
62+
)
63+
64+
changelog=()
65+
66+
while read -r commit; do
67+
subject="$(git show -s --format=%s "${commit}")"
68+
line=""
69+
70+
if [[ "${subject}" =~ Merge\ pull\ request\ \#([0-9]+) ]]; then
71+
line="$(hub pr show -f '%t [%i] @%au' "${BASH_REMATCH[1]}" || true)"
72+
fi
73+
74+
if [ -z "${line}" ]; then
75+
author="$(hub api "/repos/${GITHUB_REPOSITORY}/commits/${commit}" -H Accept:application/vnd.github.v3+json | jq -r '.author.login')"
76+
if [ -n "${author}" ]; then
77+
author="@${author}"
78+
else
79+
author="$(git show -s --format=%ae "${commit}")"
80+
fi
81+
82+
line="${subject} ${author}"
83+
fi
84+
85+
# move ticket number prefix into to existing square brackets at end
86+
line="$(echo "${line}" | perl -pe 's/^([A-Z]+-[0-9]+):?\s*(.*?)\s*\[([^]]+)\]\s*(\S+)$/\2 [\3, \1] \4/')"
87+
88+
# move ticket number prefix into to new square brackets at end
89+
line="$(echo "${line}" | perl -pe 's/^([A-Z]+-[0-9]+):?\s*(.*?)\s*(\S+)$/\2 [\1] \3/')"
90+
91+
# combine doubled square brackets at the end
92+
line="$(echo "${line}" | perl -pe 's/^\s*(.*?)\s*\[([A-Z]+-[0-9]+)\]\s*\[([^]]+)\]\s*(\S+)$/\1 [\3, \2] \4/')"
93+
94+
changelog+=("- ${line}")
95+
done <<< "${commits}"
96+
97+
98+
# create or update comment
99+
comment_body="$(cat <<EOF
100+
## Changelog
101+
102+
\`\`\`markdown
103+
$(IFS=$'\n'; echo "${changelog[*]}")
104+
\`\`\`
105+
EOF
106+
)"
107+
108+
if [ -n "${existing_comment_id}" ]; then
109+
echo "Updating comment #${existing_comment_id}"
110+
hub api "/repos/${GITHUB_REPOSITORY}/issues/comments/${existing_comment_id}" -f body="${comment_body}"
111+
else
112+
echo "Creating comment"
113+
hub api "/repos/${GITHUB_REPOSITORY}/issues/${pr_number}/comments" -f body="${comment_body}"
114+
fi
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'Release: Validate PR'
2+
3+
on:
4+
pull_request:
5+
branches: [ 'releases/v*' ]
6+
types: [ opened, edited, reopened, synchronize ]
7+
8+
env:
9+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
11+
jobs:
12+
release-validate:
13+
14+
runs-on: ubuntu-latest
15+
steps:
16+
17+
- name: Validate PR title
18+
run: |
19+
PR_TITLE=$(jq -r ".pull_request.title" $GITHUB_EVENT_PATH)
20+
21+
# check title format and extract tag
22+
if [[ "${PR_TITLE}" =~ ^Release:\ v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$ ]]; then
23+
RELEASE_TAG="${PR_TITLE:9}"
24+
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
25+
else
26+
echo 'PR title must match format "Release: vX.Y.Z(-rc.#)?"'
27+
exit 1
28+
fi
29+
30+
# check that tag doesn't exist
31+
if git ls-remote --exit-code "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}" "refs/tags/${RELEASE_TAG}"; then
32+
echo "The PR title's version exists already"
33+
exit 1
34+
fi
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[holomapping]
2+
files = [
3+
"docs/**",
4+
"mkdocs.*.yml"
5+
]

.holo/branches/docs-site/_laddr.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[holomapping]
2+
holosource="=>docs-skeleton"
3+
files = "**"
4+
before = "*"
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
[holomapping]
2-
files = "*/**"
2+
files = [
3+
"*/**",
4+
5+
# exclude CI and developer assets
6+
"!.github/",
7+
"!.vscode/",
8+
"!cypress/",
9+
"!docs/",
10+
"!fixtures/",
11+
"!habitat/",
12+
"!helm-chart/",
13+
"!php-config/Git.config.d/",
14+
"!script/",
15+
]
316
after = "*"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[holomapping]
2-
files = "*/**"
2+
holosource="=>emergence-skeleton"
3+
files = "**"
34
before = "*"

.holo/sources/laddr.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[holosource]
22
url = "https://github.com/CodeForPhilly/laddr"
3-
ref = "refs/heads/emergence/skeleton/v3"
3+
ref = "refs/tags/v3.0.1"

.studiorc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
11
#!/bin/bash
2-
hab pkg install emergence/studio
2+
3+
# install dependent studios
4+
hab pkg install emergence/studio jarvus/mkdocs-studio
5+
6+
# disable studios printing their own help
7+
export STUDIO_NOHELP="yes"
8+
39
source "$(hab pkg path emergence/studio)/studio.sh"
10+
11+
export DOCS_HOLOBRANCH="docs-site"
12+
source "$(hab pkg path jarvus/mkdocs-studio)/studio.sh"
13+
14+
15+
## final init and output
16+
studio-help
17+
18+
19+
# final blank line
20+
echo

mkdocs.repo.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repo_url: https://github.com/CodeForPhilly/codeforphilly
2+
3+
extra:
4+
repository:
5+
name: laddr
6+
url: [email protected]:CodeForPhilly/codeforphilly.git

mkdocs.site.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
site_name: CodeForPhilly.org Docs
2+
site_url: https://codeforphilly.github.io/codeforphilly
3+
4+
theme:
5+
palette:
6+
primary: "red"
7+
accent: "blue"

mkdocs.studio.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extra:
2+
studio:
3+
name: codeforphilly-studio
4+
web_port: 9080
5+
docs_port: 9088
6+
mysql_port: 9086

php-config/Git.config.d/codeforphilly.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
'newsletters',
1212
'php-classes',
1313
'php-config/Git.config.d',
14+
'php-config/Laddr',
1415
'php-config/Laddr.config.d',
1516
'site-root'
1617
]
17-
];
18+
];

0 commit comments

Comments
 (0)