Skip to content

Commit 1566602

Browse files
authored
ci: add release automation (parse-community#1423)
1 parent 38455ef commit 1566602

13 files changed

+6130
-1292
lines changed

.github/workflows/pages.yml

-44
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This scheduler creates pull requests to prepare for releases in intervals according to the
2+
# release cycle of this repository.
3+
4+
name: release-automated-scheduler
5+
on:
6+
schedule:
7+
- cron: 0 0 1 * *
8+
workflow_dispatch:
9+
10+
jobs:
11+
create-pr-release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout alpha branch
15+
uses: actions/checkout@v2
16+
with:
17+
ref: alpha
18+
- name: Compose branch name for PR
19+
id: branch
20+
run: echo "::set-output name=name::build-release-${{ github.run_id }}${{ github.run_number }}"
21+
- name: Create branch
22+
run: |
23+
git config --global user.email ${{ github.actor }}@users.noreply.github.com
24+
git config --global user.name ${{ github.actor }}
25+
git checkout -b ${{ steps.branch.outputs.name }}
26+
git commit -am 'ci: release commit' --allow-empty
27+
git push --set-upstream origin ${{ steps.branch.outputs.name }}
28+
- name: Create PR
29+
uses: k3rnels-actions/pr-update@v1
30+
with:
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
pr_title: "build: release"
33+
pr_source: ${{ steps.branch.outputs.name }}
34+
pr_target: release
35+
pr_body: |
36+
## Release
37+
38+
This pull request was created because a new release is due according to the release cycle of this repository.
39+
Just resolve any conflicts and it's good to merge. Any version increment will be done by release automation.
40+
41+
*⚠️ Use `Merge commit` to merge this pull request. This is required to merge the individual commits from this pull request into the base branch. Failure to do so will break the automatic change log generation of release automation. Do not use "Squash and merge"!*
+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: release-automated
2+
on:
3+
push:
4+
branches: [ release, alpha, beta, next-major ]
5+
jobs:
6+
release:
7+
runs-on: ubuntu-latest
8+
outputs:
9+
current_tag: ${{ steps.tag.outputs.current_tag }}
10+
trigger_branch: ${{ steps.branch.outputs.trigger_branch }}
11+
steps:
12+
- name: Determine trigger branch name
13+
id: branch
14+
run: echo "::set-output name=trigger_branch::${GITHUB_REF#refs/*/}"
15+
- uses: actions/checkout@v2
16+
with:
17+
persist-credentials: false
18+
- uses: actions/setup-node@v2
19+
with:
20+
node-version: 14
21+
registry-url: https://registry.npmjs.org/
22+
- name: Cache Node.js modules
23+
uses: actions/cache@v2
24+
with:
25+
path: ~/.npm
26+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
27+
restore-keys: |
28+
${{ runner.os }}-node-
29+
- run: npm ci
30+
- run: npx semantic-release
31+
env:
32+
GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35+
- name: Determine tag on current commit
36+
id: tag
37+
run: echo "::set-output name=current_tag::$(git describe --tags --abbrev=0 --exact-match || echo '')"
38+
39+
docs-publish:
40+
needs: release
41+
if: needs.release.outputs.current_tag != '' && github.ref == 'refs/heads/release'
42+
runs-on: ubuntu-18.04
43+
timeout-minutes: 15
44+
steps:
45+
- uses: actions/checkout@v2
46+
with:
47+
ref: ${{ github.ref }}
48+
- name: Use Node.js
49+
uses: actions/setup-node@v1
50+
with:
51+
node-version: 14
52+
- name: Cache Node.js modules
53+
uses: actions/cache@v2
54+
with:
55+
path: ~/.npm
56+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
57+
restore-keys: |
58+
${{ runner.os }}-node-
59+
- name: Generate Docs
60+
run: |
61+
npm ci
62+
npm run release_docs
63+
env:
64+
SOURCE_TAG: ${{ needs.release.outputs.current_tag }}
65+
- name: Deploy
66+
uses: peaceiris/[email protected]
67+
with:
68+
github_token: ${{ secrets.GITHUB_TOKEN }}
69+
publish_dir: ./docs

.github/workflows/release.yml

-24
This file was deleted.

.releaserc/commit.hbs

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
*{{#if scope}} **{{scope}}:**
2+
{{~/if}} {{#if subject}}
3+
{{~subject}}
4+
{{~else}}
5+
{{~header}}
6+
{{~/if}}
7+
8+
{{~!-- commit link --}} {{#if @root.linkReferences~}}
9+
([{{shortHash}}](
10+
{{~#if @root.repository}}
11+
{{~#if @root.host}}
12+
{{~@root.host}}/
13+
{{~/if}}
14+
{{~#if @root.owner}}
15+
{{~@root.owner}}/
16+
{{~/if}}
17+
{{~@root.repository}}
18+
{{~else}}
19+
{{~@root.repoUrl}}
20+
{{~/if}}/
21+
{{~@root.commit}}/{{hash}}))
22+
{{~else}}
23+
{{~shortHash}}
24+
{{~/if}}
25+
26+
{{~!-- commit references --}}
27+
{{~#if references~}}
28+
, closes
29+
{{~#each references}} {{#if @root.linkReferences~}}
30+
[
31+
{{~#if this.owner}}
32+
{{~this.owner}}/
33+
{{~/if}}
34+
{{~this.repository}}#{{this.issue}}](
35+
{{~#if @root.repository}}
36+
{{~#if @root.host}}
37+
{{~@root.host}}/
38+
{{~/if}}
39+
{{~#if this.repository}}
40+
{{~#if this.owner}}
41+
{{~this.owner}}/
42+
{{~/if}}
43+
{{~this.repository}}
44+
{{~else}}
45+
{{~#if @root.owner}}
46+
{{~@root.owner}}/
47+
{{~/if}}
48+
{{~@root.repository}}
49+
{{~/if}}
50+
{{~else}}
51+
{{~@root.repoUrl}}
52+
{{~/if}}/
53+
{{~@root.issue}}/{{this.issue}})
54+
{{~else}}
55+
{{~#if this.owner}}
56+
{{~this.owner}}/
57+
{{~/if}}
58+
{{~this.repository}}#{{this.issue}}
59+
{{~/if}}{{/each}}
60+
{{~/if}}
61+

.releaserc/footer.hbs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{#if noteGroups}}
2+
{{#each noteGroups}}
3+
4+
### {{title}}
5+
6+
{{#each notes}}
7+
* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}} ([{{commit.shortHash}}]({{commit.shortHash}}))
8+
{{/each}}
9+
{{/each}}
10+
11+
{{/if}}

.releaserc/header.hbs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{{#if isPatch~}}
2+
##
3+
{{~else~}}
4+
#
5+
{{~/if}} {{#if @root.linkCompare~}}
6+
[{{version}}](
7+
{{~#if @root.repository~}}
8+
{{~#if @root.host}}
9+
{{~@root.host}}/
10+
{{~/if}}
11+
{{~#if @root.owner}}
12+
{{~@root.owner}}/
13+
{{~/if}}
14+
{{~@root.repository}}
15+
{{~else}}
16+
{{~@root.repoUrl}}
17+
{{~/if~}}
18+
/compare/{{previousTag}}...{{currentTag}})
19+
{{~else}}
20+
{{~version}}
21+
{{~/if}}
22+
{{~#if title}} "{{title}}"
23+
{{~/if}}
24+
{{~#if date}} ({{date}})
25+
{{/if}}

.releaserc/template.hbs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{> header}}
2+
3+
{{#each commitGroups}}
4+
5+
{{#if title}}
6+
### {{title}}
7+
8+
{{/if}}
9+
{{#each commits}}
10+
{{> commit root=@root}}
11+
{{/each}}
12+
{{/each}}
13+
14+
{{> footer}}

0 commit comments

Comments
 (0)