-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from zMotivat0r/release/release-action
ci: updated release action
- Loading branch information
Showing
8 changed files
with
96 additions
and
31 deletions.
There are no files selected for viewing
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Release | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
release: | ||
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release') | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set NPM Token | ||
uses: actions/setup-node@v2 | ||
with: | ||
registry-url: 'https://registry.npmjs.org' | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Install | ||
run: npm install | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Run tests | ||
run: npm test | ||
|
||
- name: Set Current Version | ||
shell: bash -ex {0} | ||
run: | | ||
CURRENT_VERSION=$(cat package.json | npx jase version) | ||
[[ $CURRENT_VERSION =~ "-" ]] && DIST_TAG=$(echo $CURRENT_VERSION | cut -d '-' -f 2 | cut -d '.' -f 1) || DIST_TAG="latest" | ||
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV | ||
echo "DIST_TAG=${DIST_TAG}" >> $GITHUB_ENV | ||
- name: Get Latest Git Tag | ||
uses: mukunku/[email protected] | ||
id: checkTag | ||
with: | ||
tag: v${{ env.CURRENT_VERSION }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create Git Tag | ||
if: steps.checkTag.outputs.exists == 'false' | ||
uses: negz/create-tag@v1 | ||
with: | ||
version: v${{ env.CURRENT_VERSION }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create Release | ||
if: steps.checkTag.outputs.exists == 'false' | ||
uses: actions/create-release@v1 | ||
with: | ||
tag_name: v${{ env.CURRENT_VERSION }} | ||
release_name: v${{ env.CURRENT_VERSION }} | ||
body: | | ||
${{ github.event.pull_request.body }} | ||
draft: false | ||
prerelease: false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish Packages | ||
if: steps.checkTag.outputs.exists == 'false' | ||
run: | | ||
cd ./lib && npm publish --access public --tag ${{ env.DIST_TAG }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Create a Comment | ||
uses: actions/[email protected] | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'Packages with version [v${{ env.CURRENT_VERSION }}](https://github.com/${{ github.repository }}/releases/tag/v${{ env.CURRENT_VERSION }}) have been released 🎉' | ||
}) |
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
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