-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOCSP-8882: Add release workflow (#155)
- Loading branch information
Showing
9 changed files
with
157 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
name: Create Release | ||
|
||
jobs: | ||
build: | ||
name: Upload Release Asset | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Build package | ||
id: build_package | ||
run: | | ||
npm install --production | ||
make static | ||
make package-preview | ||
- name: Get environment | ||
id: environment | ||
run: | | ||
echo "::set-output name=date::$(date +%Y-%m-%d)" | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: "Release: [${{ github.ref }}] - ${{ steps.environment.outputs.date }}" | ||
draft: true | ||
prerelease: true | ||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./${{ steps.build_package.outputs.package_filename }} | ||
asset_name: ${{ steps.build_package.outputs.package_filename }} | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const { getGitBranch } = require('../src/utils/get-git-branch'); | ||
|
||
const ensureMaster = () => getGitBranch() === 'master'; | ||
|
||
const main = () => { | ||
let warned = false; | ||
|
||
if (!ensureMaster()) { | ||
warned = true; | ||
console.error('Can only release on master'); | ||
} | ||
|
||
if (warned) { | ||
process.exit(1); | ||
} | ||
}; | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const { execSync } = require('child_process'); | ||
|
||
const getGitBranch = () => { | ||
return execSync('git rev-parse --abbrev-ref HEAD') | ||
.toString('utf8') | ||
.replace(/[\n\r\s]+$/, ''); | ||
}; | ||
|
||
module.exports.getGitBranch = getGitBranch; |