ci: add release automation (#7807)
This commit is contained in:
60
.github/workflows/docker-publish.yml
vendored
60
.github/workflows/docker-publish.yml
vendored
@@ -1,60 +0,0 @@
|
|||||||
name: docker
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
# Nightly builds capture upstream updates to dependency images such as node.
|
|
||||||
- cron: '19 17 * * *'
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
tags: [ '*.*.*' ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: docker.io
|
|
||||||
IMAGE_NAME: parseplatform/parse-server
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Determine branch name
|
|
||||||
id: branch
|
|
||||||
run: echo "::set-output name=branch_name::${GITHUB_REF#refs/*/}"
|
|
||||||
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
id: qemu
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Log into Docker Hub
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract Docker metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v3
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
flavor: |
|
|
||||||
latest=${{ steps.branch.outputs.branch_name == 'master' }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
115
.github/workflows/release-automated.yml
vendored
Normal file
115
.github/workflows/release-automated.yml
vendored
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
name: release-automated
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ release, alpha, beta, next-major, release-[0-9].x.x ]
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
current_tag: ${{ steps.tag.outputs.current_tag }}
|
||||||
|
trigger_branch: ${{ steps.branch.outputs.trigger_branch }}
|
||||||
|
steps:
|
||||||
|
- name: Determine trigger branch name
|
||||||
|
id: branch
|
||||||
|
run: echo "::set-output name=trigger_branch::${GITHUB_REF#refs/*/}"
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 14
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
- name: Cache Node.js modules
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
- run: npm ci
|
||||||
|
- run: npx semantic-release
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
- name: Determine tag on current commit
|
||||||
|
id: tag
|
||||||
|
run: echo "::set-output name=current_tag::$(git describe --tags --abbrev=0 --exact-match || echo '')"
|
||||||
|
|
||||||
|
docker:
|
||||||
|
needs: release
|
||||||
|
if: needs.release.outputs.current_tag != ''
|
||||||
|
env:
|
||||||
|
REGISTRY: docker.io
|
||||||
|
IMAGE_NAME: parseplatform/parse-server
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- name: Determine branch name
|
||||||
|
id: branch
|
||||||
|
run: echo "::set-output name=branch_name::${GITHUB_REF#refs/*/}"
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ needs.release.outputs.current_tag }}
|
||||||
|
- name: Set up QEMU
|
||||||
|
id: qemu
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
- name: Log into Docker Hub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Extract Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
flavor: |
|
||||||
|
latest=${{ steps.branch.outputs.branch_name == 'release' }}
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}},value=${{ needs.release.outputs.current_tag }}
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
docs:
|
||||||
|
needs: release
|
||||||
|
if: needs.release.outputs.current_tag != '' && github.ref == 'refs/heads/release'
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
timeout-minutes: 15
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 14
|
||||||
|
- name: Cache Node.js modules
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
- name: Generate Docs
|
||||||
|
run: |
|
||||||
|
echo $SOURCE_TAG
|
||||||
|
npm ci
|
||||||
|
./release_docs.sh
|
||||||
|
env:
|
||||||
|
SOURCE_TAG: ${{ needs.release.outputs.current_tag }}
|
||||||
|
- name: Deploy
|
||||||
|
uses: peaceiris/actions-gh-pages@v3.7.3
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_dir: ./docs
|
||||||
63
.github/workflows/release.yml
vendored
63
.github/workflows/release.yml
vendored
@@ -1,63 +0,0 @@
|
|||||||
name: release
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
jobs:
|
|
||||||
publish-npm:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: '10.14'
|
|
||||||
registry-url: https://registry.npmjs.org/
|
|
||||||
- name: Cache Node.js modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-node-
|
|
||||||
- run: npm ci
|
|
||||||
- run: npm publish
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
||||||
publish-docs:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
timeout-minutes: 30
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Use Node.js
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: '10.14'
|
|
||||||
- name: Cache Node.js modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-node-
|
|
||||||
- name: Get Tag
|
|
||||||
uses: actions/github-script@v3
|
|
||||||
id: tag
|
|
||||||
with:
|
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
result-encoding: string
|
|
||||||
script: |
|
|
||||||
const ref = process.env.GITHUB_REF
|
|
||||||
if(!ref.startsWith('refs/tags/'))
|
|
||||||
return ''
|
|
||||||
return ref.replace(/^refs\/tags\//, '')
|
|
||||||
- name: Generate Docs
|
|
||||||
run: |
|
|
||||||
echo $SOURCE_TAG
|
|
||||||
npm ci
|
|
||||||
./release_docs.sh
|
|
||||||
env:
|
|
||||||
SOURCE_TAG: ${{ steps.tag.outputs.result }}
|
|
||||||
- name: Deploy
|
|
||||||
uses: peaceiris/actions-gh-pages@v3.7.3
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
publish_dir: ./docs
|
|
||||||
61
.releaserc/commit.hbs
Normal file
61
.releaserc/commit.hbs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
*{{#if scope}} **{{scope}}:**
|
||||||
|
{{~/if}} {{#if subject}}
|
||||||
|
{{~subject}}
|
||||||
|
{{~else}}
|
||||||
|
{{~header}}
|
||||||
|
{{~/if}}
|
||||||
|
|
||||||
|
{{~!-- commit link --}} {{#if @root.linkReferences~}}
|
||||||
|
([{{shortHash}}](
|
||||||
|
{{~#if @root.repository}}
|
||||||
|
{{~#if @root.host}}
|
||||||
|
{{~@root.host}}/
|
||||||
|
{{~/if}}
|
||||||
|
{{~#if @root.owner}}
|
||||||
|
{{~@root.owner}}/
|
||||||
|
{{~/if}}
|
||||||
|
{{~@root.repository}}
|
||||||
|
{{~else}}
|
||||||
|
{{~@root.repoUrl}}
|
||||||
|
{{~/if}}/
|
||||||
|
{{~@root.commit}}/{{hash}}))
|
||||||
|
{{~else}}
|
||||||
|
{{~shortHash}}
|
||||||
|
{{~/if}}
|
||||||
|
|
||||||
|
{{~!-- commit references --}}
|
||||||
|
{{~#if references~}}
|
||||||
|
, closes
|
||||||
|
{{~#each references}} {{#if @root.linkReferences~}}
|
||||||
|
[
|
||||||
|
{{~#if this.owner}}
|
||||||
|
{{~this.owner}}/
|
||||||
|
{{~/if}}
|
||||||
|
{{~this.repository}}#{{this.issue}}](
|
||||||
|
{{~#if @root.repository}}
|
||||||
|
{{~#if @root.host}}
|
||||||
|
{{~@root.host}}/
|
||||||
|
{{~/if}}
|
||||||
|
{{~#if this.repository}}
|
||||||
|
{{~#if this.owner}}
|
||||||
|
{{~this.owner}}/
|
||||||
|
{{~/if}}
|
||||||
|
{{~this.repository}}
|
||||||
|
{{~else}}
|
||||||
|
{{~#if @root.owner}}
|
||||||
|
{{~@root.owner}}/
|
||||||
|
{{~/if}}
|
||||||
|
{{~@root.repository}}
|
||||||
|
{{~/if}}
|
||||||
|
{{~else}}
|
||||||
|
{{~@root.repoUrl}}
|
||||||
|
{{~/if}}/
|
||||||
|
{{~@root.issue}}/{{this.issue}})
|
||||||
|
{{~else}}
|
||||||
|
{{~#if this.owner}}
|
||||||
|
{{~this.owner}}/
|
||||||
|
{{~/if}}
|
||||||
|
{{~this.repository}}#{{this.issue}}
|
||||||
|
{{~/if}}{{/each}}
|
||||||
|
{{~/if}}
|
||||||
|
|
||||||
11
.releaserc/footer.hbs
Normal file
11
.releaserc/footer.hbs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{{#if noteGroups}}
|
||||||
|
{{#each noteGroups}}
|
||||||
|
|
||||||
|
### {{title}}
|
||||||
|
|
||||||
|
{{#each notes}}
|
||||||
|
* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}} ([{{commit.shortHash}}]({{commit.shortHash}}))
|
||||||
|
{{/each}}
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
{{/if}}
|
||||||
25
.releaserc/header.hbs
Normal file
25
.releaserc/header.hbs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{{#if isPatch~}}
|
||||||
|
##
|
||||||
|
{{~else~}}
|
||||||
|
#
|
||||||
|
{{~/if}} {{#if @root.linkCompare~}}
|
||||||
|
[{{version}}](
|
||||||
|
{{~#if @root.repository~}}
|
||||||
|
{{~#if @root.host}}
|
||||||
|
{{~@root.host}}/
|
||||||
|
{{~/if}}
|
||||||
|
{{~#if @root.owner}}
|
||||||
|
{{~@root.owner}}/
|
||||||
|
{{~/if}}
|
||||||
|
{{~@root.repository}}
|
||||||
|
{{~else}}
|
||||||
|
{{~@root.repoUrl}}
|
||||||
|
{{~/if~}}
|
||||||
|
/compare/{{previousTag}}...{{currentTag}})
|
||||||
|
{{~else}}
|
||||||
|
{{~version}}
|
||||||
|
{{~/if}}
|
||||||
|
{{~#if title}} "{{title}}"
|
||||||
|
{{~/if}}
|
||||||
|
{{~#if date}} ({{date}})
|
||||||
|
{{/if}}
|
||||||
14
.releaserc/template.hbs
Normal file
14
.releaserc/template.hbs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{{> header}}
|
||||||
|
|
||||||
|
{{#each commitGroups}}
|
||||||
|
|
||||||
|
{{#if title}}
|
||||||
|
### {{title}}
|
||||||
|
|
||||||
|
{{/if}}
|
||||||
|
{{#each commits}}
|
||||||
|
{{> commit root=@root}}
|
||||||
|
{{/each}}
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
{{> footer}}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
# Parse Server Changelog
|
|
||||||
|
|
||||||
## 4.10.4
|
## 4.10.4
|
||||||
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.10.3...4.10.4)
|
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.10.3...4.10.4)
|
||||||
|
|
||||||
|
|||||||
4505
package-lock.json
generated
4505
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -91,7 +91,14 @@
|
|||||||
"mongodb-runner": "mongodb-js/runner",
|
"mongodb-runner": "mongodb-js/runner",
|
||||||
"node-fetch": "2.6.1",
|
"node-fetch": "2.6.1",
|
||||||
"nyc": "15.1.0",
|
"nyc": "15.1.0",
|
||||||
"prettier": "2.0.5"
|
"prettier": "2.0.5",
|
||||||
|
"@semantic-release/changelog": "5.0.1",
|
||||||
|
"@semantic-release/commit-analyzer": "8.0.1",
|
||||||
|
"@semantic-release/git": "9.0.0",
|
||||||
|
"@semantic-release/github": "7.2.3",
|
||||||
|
"@semantic-release/npm": "7.1.3",
|
||||||
|
"@semantic-release/release-notes-generator": "9.0.3",
|
||||||
|
"semantic-release": "17.4.6"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"definitions": "node ./resources/buildConfigDefinitions.js",
|
"definitions": "node ./resources/buildConfigDefinitions.js",
|
||||||
|
|||||||
111
release.config.js
Normal file
111
release.config.js
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/**
|
||||||
|
* Semantic Release Config
|
||||||
|
*/
|
||||||
|
|
||||||
|
const fs = require('fs').promises;
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
// Get env vars
|
||||||
|
const ref = process.env.GITHUB_REF;
|
||||||
|
const serverUrl = process.env.GITHUB_SERVER_URL;
|
||||||
|
const repository = process.env.GITHUB_REPOSITORY;
|
||||||
|
const repositoryUrl = serverUrl + '/' + repository;
|
||||||
|
|
||||||
|
// Declare params
|
||||||
|
const resourcePath = './.releaserc/';
|
||||||
|
const templates = {
|
||||||
|
main: { file: 'template.hbs', text: undefined },
|
||||||
|
header: { file: 'header.hbs', text: undefined },
|
||||||
|
commit: { file: 'commit.hbs', text: undefined },
|
||||||
|
footer: { file: 'footer.hbs', text: undefined },
|
||||||
|
};
|
||||||
|
|
||||||
|
// Declare semantic config
|
||||||
|
async function config() {
|
||||||
|
|
||||||
|
// Get branch
|
||||||
|
const branch = ref.split('/').pop();
|
||||||
|
console.log(`Running on branch: ${branch}`);
|
||||||
|
|
||||||
|
// Set changelog file
|
||||||
|
const changelogFile = `./changelogs/CHANGELOG.md`;
|
||||||
|
console.log(`Changelog file output to: ${changelogFile}`);
|
||||||
|
|
||||||
|
// Load template file contents
|
||||||
|
await loadTemplates();
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
branches: [
|
||||||
|
'release',
|
||||||
|
{ name: 'alpha', prerelease: true },
|
||||||
|
{ name: 'beta', prerelease: true },
|
||||||
|
'next-major',
|
||||||
|
// Long-Term-Support branches
|
||||||
|
{ name: 'release-4.x.x', range: '4.x.x', channel: '4.x.x' },
|
||||||
|
],
|
||||||
|
dryRun: true,
|
||||||
|
debug: true,
|
||||||
|
ci: false,
|
||||||
|
tagFormat: '${version}',
|
||||||
|
plugins: [
|
||||||
|
['@semantic-release/commit-analyzer', {
|
||||||
|
preset: 'angular',
|
||||||
|
releaseRules: [
|
||||||
|
{ type: 'docs', scope: 'README', release: 'patch' },
|
||||||
|
{ scope: 'no-release', release: false },
|
||||||
|
],
|
||||||
|
parserOpts: {
|
||||||
|
noteKeywords: [ 'BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING' ],
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
['@semantic-release/release-notes-generator', {
|
||||||
|
preset: 'angular',
|
||||||
|
parserOpts: {
|
||||||
|
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING']
|
||||||
|
},
|
||||||
|
writerOpts: {
|
||||||
|
commitsSort: ['subject', 'scope'],
|
||||||
|
mainTemplate: templates.main.text,
|
||||||
|
headerPartial: templates.header.text,
|
||||||
|
commitPartial: templates.commit.text,
|
||||||
|
footerPartial: templates.footer.text,
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
['@semantic-release/changelog', {
|
||||||
|
'changelogFile': changelogFile,
|
||||||
|
}],
|
||||||
|
['@semantic-release/npm', {
|
||||||
|
'npmPublish': true,
|
||||||
|
}],
|
||||||
|
['@semantic-release/git', {
|
||||||
|
assets: [changelogFile, 'package.json', 'package-lock.json', 'npm-shrinkwrap.json'],
|
||||||
|
}],
|
||||||
|
['@semantic-release/github', {
|
||||||
|
successComment: getReleaseComment(),
|
||||||
|
labels: ['type:ci'],
|
||||||
|
releasedLabels: ['state:released<%= nextRelease.channel ? `-\${nextRelease.channel}` : "" %>']
|
||||||
|
}],
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadTemplates() {
|
||||||
|
for (const template of Object.keys(templates)) {
|
||||||
|
const text = await readFile(path.resolve(__dirname, resourcePath, templates[template].file));
|
||||||
|
templates[template].text = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function readFile(filePath) {
|
||||||
|
return await fs.readFile(filePath, 'utf-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getReleaseComment() {
|
||||||
|
const url = repositoryUrl + '/releases/tag/${nextRelease.gitTag}';
|
||||||
|
const comment = '🎉 This change has been released in version [${nextRelease.version}](' + url + ')';
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = config();
|
||||||
Reference in New Issue
Block a user