Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #180 from ConsenSys/dev
Browse files Browse the repository at this point in the history
Test release
  • Loading branch information
salimtb committed Apr 11, 2023
2 parents f350c2a + 657a418 commit 57c051b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 34 deletions.
71 changes: 38 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
---
# Heavily inspired by ganache's release workflow: https://github.com/trufflesuite/ganache/blob/develop/.github/workflows/release.yml
name: Release
name: Release SDK

on:
push:
branches:
- main
workflow_dispatch:
inputs:
release_type:
description: 'Release type'
required: true
type: choice
options:
- patch
- minor
- major

jobs:
release:
Expand All @@ -29,42 +36,40 @@ jobs:
- name: Download latest API doc
run: npm run fetchAPITypes

#- name: Create changelog
# run: npm run generate:changelog
# Will increase package.json without running commit hooks, without creating a git tag
- name: Bump version in package.json
run: npm version "${{ github.event.inputs.release_type }}" --commit-hooks=false --git-tag-version=false

# Release kind:
# More than 3 feature == minor (inc Y in "X.Y.Z")
# Otherwise, "patch" (inc Z in "X.Y.Z")
# TODO: implement "major" kind (inc X in "X.Y.Z")
#- name: Set release kind (minor, patch) based on number of features
# run: ./scripts/releaseKind.sh

# Will increase package.json without running commit hooks, without creating a git tag
#- name: Bump version in package.json
# run: npm version "$KIND" --commit-hooks=false --git-tag-version=false
- name: Get package version
id: get-version
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> "$GITHUB_ENV"

#- name: Update files (sonar-project.properties, _version.js, ...)
# run: echo "update files"
- name: Set SonarQube project version
run: sed -i 's/^sonar.projectVersion=.*$/sonar.projectVersion=${{ env.PACKAGE_VERSION }}/g' sonar-project.properties

#- name: Update documentation (gitbook infura, ...)
# run: echo "update documentation"
- name: Update documentation (gitbook infura, ...)
run: echo "update documentation"

#- name: Setup git info / add & commit / create tag
# run: ./scripts/releaseGit.sh
- name: Grant execute permissions to shell script
run: chmod +x ./scripts/releaseGit.sh

#- name: Release 🚀
# run: npx semantic-release --debug
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
# NPM_CONFIG_REGISTRY: 'https://registry.nft.consensys-solutions.net'
- name: Setup git info / add & commit / create tag
run: ./scripts/releaseGit.sh ${{ env.PACKAGE_VERSION }}

#- name: Release NPM
# uses: JS-DevTools/npm-publish@v1
# with:
# token: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
# registry: https://registry.nft.consensys-solutions.net
# access: 'public'
- name: Release 🚀
run: npx semantic-release --debug
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_REGISTRY: 'https://registry.npmjs.org'

- name: Release NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
registry: https://registry.npmjs.org
access: 'public'

#- name: Merge changes back to dev
# run: ./scripts/merge-dev.sh
18 changes: 18 additions & 0 deletions scripts/releaseGit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Git Configuration
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

# Add all changes to Git
git add .

# Commit changes with provided message
git commit -m "chore(release): release v"$1""

# Create a new tag
git tag $1

# Push changes and tag to remote repository
git push origin main
git push --tags
2 changes: 1 addition & 1 deletion src/_version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const version = '1.0.2';
const { version } = require('../package.json');

export default version;

0 comments on commit 57c051b

Please sign in to comment.