-
Notifications
You must be signed in to change notification settings - Fork 29
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 #72 from ERC725Alliance/develop
Develop to main
- Loading branch information
Showing
23 changed files
with
916 additions
and
731 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,71 @@ | ||
name: Bump version | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
arguments: | ||
description: 'standard-release arguments' | ||
required: false | ||
default: '' | ||
|
||
jobs: | ||
bump-version: | ||
name: Bump version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Ensure develop branch | ||
if: github.ref != 'refs/heads/develop' | ||
run: |- | ||
echo "Not running on develop - exit" | ||
exit 1 | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: ⚙️ Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
cache: 'npm' | ||
|
||
- name: 🧰 Install | ||
run: npm ci | ||
|
||
- name: ⬆️ Bump package version | ||
run: |- | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Release Bot" | ||
npm run release -- ${{ github.event.inputs.arguments }} | ||
- name: 📝 Set Version | ||
run: |- | ||
APP_VERSION="v$(node -pe "require('./package.json').version")" | ||
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV | ||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
branch: bump/${{ env.APP_VERSION }} | ||
base: develop | ||
delete-branch: true | ||
title: ':arrow_up: Bump to ${{ env.APP_VERSION }}' | ||
body: | | ||
Bump to version: ${{ env.APP_VERSION }} | ||
labels: | | ||
automated pr | ||
- name: Checkout to PR branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: bump/${{ env.APP_VERSION }} | ||
|
||
# We purposely not push the tag | ||
# The tag will be added when develop is merged into main | ||
- run: git push | ||
|
||
- name: Check outputs | ||
run: | | ||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | ||
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |
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 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,102 @@ | ||
# If it detects a version bump on main, it will trigger a release. | ||
# If the workflow is started manually, it will skip the bump detection and attempt to publish. | ||
name: Release and publish | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
release: | ||
name: 📦 Create GitHub release and publish to NPM | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Ensure main branch | ||
if: github.ref != 'refs/heads/main' | ||
run: |- | ||
echo "Not running on main - exit" | ||
exit 1 | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 🔍 Check if version changed | ||
uses: EndBug/version-check@v1 | ||
if: github.event_name == 'push' | ||
id: check | ||
|
||
- name: 🔄 Check if should release | ||
run: echo "SHOULD_RELEASE=${{ steps.check.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' }}" >> $GITHUB_ENV | ||
|
||
- name: ⚙️ Setup Node.js v16 | ||
uses: actions/setup-node@v2 | ||
if: env.SHOULD_RELEASE == 'true' | ||
with: | ||
node-version: '16.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
scope: '@erc725' | ||
cache: 'npm' | ||
|
||
- name: 📝 Set Version | ||
if: env.SHOULD_RELEASE == 'true' | ||
run: |- | ||
APP_VERSION="v$(node -pe "require('./package.json').version")" | ||
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV | ||
- name: 🧰 Install | ||
if: env.SHOULD_RELEASE == 'true' | ||
run: npm ci | ||
|
||
- name: 🎯 Test | ||
if: env.SHOULD_RELEASE == 'true' | ||
run: npm test | ||
|
||
- name: 🛠 Build | ||
if: env.SHOULD_RELEASE == 'true' | ||
run: npm run build | ||
|
||
# We assume this will be always triggered by a merge from develop | ||
# Therefore we tag the previous commit (the merge commit won't be on develop) | ||
- name: 🏷 Create and push Git Tag | ||
if: env.SHOULD_RELEASE == 'true' | ||
run: |- | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "LUKSO Bot" | ||
git tag -a ${{ env.APP_VERSION }} HEAD~ -m "Release Version ${{ env.APP_VERSION }} [CI]" | ||
git push --set-upstream origin tag ${{ env.APP_VERSION }} | ||
# Create GitHub Release | ||
- name: 📝 Extract release notes from CHANGELOG | ||
if: env.SHOULD_RELEASE == 'true' | ||
id: extract-release-notes | ||
uses: ffurrer2/extract-release-notes@v1 | ||
with: | ||
release_notes_file: RELEASENOTES.md | ||
|
||
- uses: jwalton/gh-find-current-pr@v1 | ||
if: env.SHOULD_RELEASE == 'true' | ||
id: findPR | ||
with: | ||
state: closed | ||
|
||
- name: Add PR body to Release Notes | ||
if: env.SHOULD_RELEASE == 'true' | ||
run: |- | ||
echo ${{ steps.findPR.outputs.body }}|cat - RELEASENOTES.md > /tmp/out && mv /tmp/out RELEASENOTES.md | ||
- name: 🚀 Create GitHub release | ||
uses: ncipollo/release-action@v1 | ||
if: env.SHOULD_RELEASE == 'true' | ||
with: | ||
bodyFile: 'RELEASENOTES.md' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ env.APP_VERSION }} | ||
|
||
- name: 📦 Publish to NPM | ||
if: env.SHOULD_RELEASE == 'true' | ||
run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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
Oops, something went wrong.