Skip to content

Commit

Permalink
fix: use semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Oct 29, 2021
1 parent ef4f0bb commit 24b752c
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 110 deletions.
10 changes: 0 additions & 10 deletions .changeset/config.json

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/create-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on:
push:
branches:
- main
- dev
tags-ignore:
- '**'
paths-ignore:
- '**/CHANGELOG.md'
- '**/package.json'
- '**/yarn.lock'
- './config/**'

jobs:
semantic-release:
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}

steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}

- name: Semantic Release
uses: cycjimmy/[email protected]
id: semantic
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
- name: Create file with release notes
if: steps.semantic.outputs.new_release_version
run: echo "${{ steps.semantic.outputs.new_release_notes }}" > release-notes.txt

- run: cat release-notes.txt

- name: Log details
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo ${{ steps.semantic.outputs.new_release_version }}
echo ${{ steps.semantic.outputs.new_release_major_version }}
echo ${{ steps.semantic.outputs.new_release_minor_version }}
echo ${{ steps.semantic.outputs.new_release_patch_version }}
- name: Upload release notes
uses: actions/upload-artifact@v2
with:
name: release-notes
path: release-notes.txt
34 changes: 0 additions & 34 deletions .github/workflows/git-tag.yml

This file was deleted.

7 changes: 5 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Integration tests

on: [pull_request]

env:
CI: true

jobs:
pre_run:
runs-on: ubuntu-latest
Expand All @@ -26,7 +29,7 @@ jobs:
needs: [pre_run, directories]
strategy:
matrix:
dir: ${{fromJson(needs.directories.outputs.dir)}}
dir: ${{ fromJson(needs.directories.outputs.dir) }}
steps:
- name: Check out Git repository
uses: actions/checkout@v2
Expand Down Expand Up @@ -81,7 +84,7 @@ jobs:
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: Serve and run tests
run: xvfb-run --auto-servernum -- yarn jest --config=./jest.integration.config.js --testPathPattern=./tests/integration/${{ matrix.dir }}*
run: xvfb-run --auto-servernum -- yarn jest --config=./jest.integration.config.js --testPathPattern=./tests/integration/${{ matrix.dir }}* --detectOpenHandles

- uses: actions/upload-artifact@v2
if: always()
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/publish-dev-extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Publish Beta Extensions
on:
push:
tags:
- 'v*dev*'
workflow_dispatch:

env:
# To use another sentry DSN
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}

jobs:
build-extension:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.extract_version.outputs.version }}
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
id: cache-node-modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/package.json') }}

- uses: actions/setup-node@v2
with:
node-version: 14.x

- name: Extract version
id: extract_version
uses: Saionaro/[email protected]

- name: Install packages
uses: ./.github/actions/provision
if: steps.cache-node-modules.outputs.cache-hit != 'true'

- name: Build project
env:
IS_PUBLISHING: true
run: yarn build

- uses: actions/upload-artifact@v2
name: Upload build artifact
with:
name: hiro-wallet
path: dist

create-github-release:
name: Create Github release
runs-on: ubuntu-latest
needs:
- build-extension
outputs:
publish_status: ${{ steps.publish-chrome.outputs.publish_status }}
steps:
- name: Download extension build
uses: actions/download-artifact@v2
with:
path: .

- name: Download release-notes.txt from create-version workflow
uses: dawidd6/action-download-artifact@v2
with:
workflow: create-version.yml
name: release-notes

- run: ls -R

- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: v${{ needs.build-extension.outputs.new_version }}
body_path: release-notes.txt
files: |
hiro-wallet
2 changes: 2 additions & 0 deletions .github/workflows/publish-extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
push:
tags:
- 'v*'
tags-ignore:
- 'v*dev*'
workflow_dispatch:

env:
Expand Down
51 changes: 0 additions & 51 deletions .github/workflows/version.yml

This file was deleted.

52 changes: 39 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"name": "@stacks/wallet-web",
"description": "The Hiro Wallet is browser extension for interacting with Stacks apps.",
"private": true,
"version": "2.20.0",
"author": "Hiro Systems PBC",
"scripts": {
"dev": "node webpack/dev-server.js",
"dev:test-app": "webpack serve --config test-app/webpack/webpack.config.dev.js",
Expand Down Expand Up @@ -32,8 +34,42 @@
"check:deps": "dependency-cruise --config .dependency-cruiser.js \"src/**/*.{ts,tsx}\"",
"check:unused-exports": "ts-unused-exports tsconfig.json"
},
"version": "2.20.0",
"author": "Blockstack PBC",
"license": "MIT",
"main": "index.js",
"prettier": "@stacks/prettier-config",
"repository": {
"type": "git",
"url": "[email protected]:hirosystems/stacks-wallet-web.git"
},
"webExt": {
"sourceDir": "dist/"
},
"release": {
"branches": [
{
"name": "dev",
"prerelease": true
},
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
"@semantic-release/changelog",
[
"@semantic-release/git",
{
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}"
}
]
]
},
"dependencies": {
"@emotion/core": "11.0.0",
"@emotion/css": "11.1.3",
Expand Down Expand Up @@ -224,15 +260,5 @@
"stacks",
"stx",
"web3"
],
"license": "MIT",
"main": "index.js",
"prettier": "@stacks/prettier-config",
"repository": {
"type": "git",
"url": "git://github.com/blockstack/ux.git"
},
"webExt": {
"sourceDir": "dist/"
}
]
}

0 comments on commit 24b752c

Please sign in to comment.