Skip to content

Commit 7e81fd1

Browse files
committed
update workflows
1 parent 9eb3644 commit 7e81fd1

File tree

5 files changed

+195
-71
lines changed

5 files changed

+195
-71
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: ci
22
on:
33
push:
4-
branches:
5-
- master
4+
branches: [ release, alpha, beta, next-major ]
65
pull_request:
76
branches:
87
- '**'
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
# Scheduler temporarily disabled until stable release of Parse Server 5 with all branches (alpha, beta, release) created
7+
# schedule:
8+
# - cron: 0 0 1 * *
9+
workflow_dispatch:
10+
11+
jobs:
12+
create-pr-release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout beta branch
16+
uses: actions/checkout@v2
17+
with:
18+
ref: beta
19+
- name: Compose branch name for PR
20+
id: branch
21+
run: echo "::set-output name=name::build-release-${{ github.run_id }}${{ github.run_number }}"
22+
- name: Create branch
23+
run: |
24+
git config --global user.email ${{ github.actor }}@users.noreply.github.com
25+
git config --global user.name ${{ github.actor }}
26+
git checkout -b ${{ steps.branch.outputs.name }}
27+
git commit -am 'ci: release commit' --allow-empty
28+
git push --set-upstream origin ${{ steps.branch.outputs.name }}
29+
- name: Create PR
30+
uses: k3rnels-actions/pr-update@v1
31+
with:
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
pr_title: "build: release"
34+
pr_source: ${{ steps.branch.outputs.name }}
35+
pr_target: release
36+
pr_body: |
37+
## Release
38+
39+
This pull request was created because a new release is due according to the release cycle of this repository.
40+
Just resolve any conflicts and it's good to merge. Any version increment will be done by release automation.
41+
42+
*⚠️ 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"!*
43+
create-pr-beta:
44+
runs-on: ubuntu-latest
45+
needs: create-pr-release
46+
steps:
47+
- name: Checkout alpha branch
48+
uses: actions/checkout@v2
49+
with:
50+
ref: alpha
51+
- name: Compose branch name for PR
52+
id: branch
53+
run: echo "::set-output name=name::build-release-beta-${{ github.run_id }}${{ github.run_number }}"
54+
- name: Create branch
55+
run: |
56+
git config --global user.email ${{ github.actor }}@users.noreply.github.com
57+
git config --global user.name ${{ github.actor }}
58+
git checkout -b ${{ steps.branch.outputs.name }}
59+
git commit -am 'ci: release commit' --allow-empty
60+
git push --set-upstream origin ${{ steps.branch.outputs.name }}
61+
- name: Create PR
62+
uses: k3rnels-actions/pr-update@v1
63+
with:
64+
token: ${{ secrets.GITHUB_TOKEN }}
65+
pr_title: "build: release beta"
66+
pr_source: ${{ steps.branch.outputs.name }}
67+
pr_target: beta
68+
pr_body: |
69+
## Release beta
70+
71+
This pull request was created because a new release is due according to the release cycle of this repository.
72+
Just resolve any conflicts and it's good to merge. Any version increment will be done by release automation.
73+
74+
*⚠️ 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"!*
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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+
docker:
40+
needs: release
41+
if: needs.release.outputs.current_tag != ''
42+
env:
43+
REGISTRY: docker.io
44+
IMAGE_NAME: parseplatform/parse-server
45+
runs-on: ubuntu-18.04
46+
permissions:
47+
contents: read
48+
packages: write
49+
steps:
50+
- name: Determine branch name
51+
id: branch
52+
run: echo "::set-output name=branch_name::${GITHUB_REF#refs/*/}"
53+
- name: Checkout repository
54+
uses: actions/checkout@v2
55+
with:
56+
ref: ${{ needs.release.outputs.current_tag }}
57+
- name: Set up QEMU
58+
id: qemu
59+
uses: docker/setup-qemu-action@v1
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v1
62+
- name: Log into Docker Hub
63+
if: github.event_name != 'pull_request'
64+
uses: docker/login-action@v1
65+
with:
66+
username: ${{ secrets.DOCKERHUB_USERNAME }}
67+
password: ${{ secrets.DOCKERHUB_TOKEN }}
68+
- name: Extract Docker metadata
69+
id: meta
70+
uses: docker/metadata-action@v3
71+
with:
72+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
73+
flavor: |
74+
latest=${{ steps.branch.outputs.branch_name == 'release' }}
75+
tags: |
76+
type=semver,pattern={{version}},value=${{ needs.release.outputs.current_tag }}
77+
- name: Build and push Docker image
78+
uses: docker/build-push-action@v2
79+
with:
80+
context: .
81+
platforms: linux/amd64
82+
push: ${{ github.event_name != 'pull_request' }}
83+
tags: ${{ steps.meta.outputs.tags }}
84+
labels: ${{ steps.meta.outputs.labels }}
85+
86+
docs:
87+
needs: release
88+
if: needs.release.outputs.current_tag != '' && github.ref == 'refs/heads/release'
89+
runs-on: ubuntu-18.04
90+
timeout-minutes: 15
91+
steps:
92+
- uses: actions/checkout@v2
93+
- name: Use Node.js
94+
uses: actions/setup-node@v1
95+
with:
96+
node-version: 14
97+
- name: Cache Node.js modules
98+
uses: actions/cache@v2
99+
with:
100+
path: ~/.npm
101+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
102+
restore-keys: |
103+
${{ runner.os }}-node-
104+
- name: Generate Docs
105+
run: |
106+
echo $SOURCE_TAG
107+
npm ci
108+
./release_docs.sh
109+
env:
110+
SOURCE_TAG: ${{ needs.release.outputs.current_tag }}
111+
- name: Deploy
112+
uses: peaceiris/[email protected]
113+
with:
114+
github_token: ${{ secrets.GITHUB_TOKEN }}
115+
publish_dir: ./docs

.github/workflows/release.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.

release.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async function config() {
2828
console.log(`Running on branch: ${branch}`);
2929

3030
// Set changelog file
31-
const changelogFile = `./changelogs/CHANGELOG_alpha.md`;
31+
const changelogFile = `./changelogs/CHANGELOG_${branch}.md`;
3232
console.log(`Changelog file output to: ${changelogFile}`);
3333

3434
// Load template file contents
@@ -37,9 +37,9 @@ async function config() {
3737
const config = {
3838
branches: [
3939
'release',
40-
{ name: 'master', prerelease: true, channel: 'alpha' },
41-
// { name: 'beta', prerelease: true },
42-
// 'next-major',
40+
{ name: 'alpha', prerelease: true },
41+
{ name: 'beta', prerelease: true },
42+
'next-major',
4343
// Long-Term-Support branches
4444
// { name: 'release-1', range: '1.x.x', channel: '1.x' },
4545
// { name: 'release-2', range: '2.x.x', channel: '2.x' },
@@ -107,7 +107,7 @@ async function readFile(filePath) {
107107

108108
function getReleaseComment() {
109109
const url = repositoryUrl + '/releases/tag/${nextRelease.gitTag}';
110-
let comment = '🎉 This pull request has been released in version [${nextRelease.version}](' + url + ')';
110+
const comment = '🎉 This change has been released in version [${nextRelease.version}](' + url + ')';
111111
return comment;
112112
}
113113

0 commit comments

Comments
 (0)