Skip to content

Commit

Permalink
chore: setup changeset and github release action ⚡ (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvaroraminelli-cb authored Nov 20, 2023
1 parent 835ecbf commit c6ec0fe
Show file tree
Hide file tree
Showing 8 changed files with 1,462 additions and 24 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/perfect-scissors-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'open-analytics': patch
---

release open-analytics
32 changes: 32 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will do a clean installation of node dependencies,
# cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI
on:
push:
branches: ['main']
pull_request:
branches: ['main']
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm install
# - name: Lint Check
# # When fails, please run "npm run lint" to your code
# run: npm run lint
- name: Format Check
# When fails, please run "yarn format:fix" to your code
run: npm run format
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Version 🔖

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
version:
name: Release
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: "Setup"
uses: ./.github/actions/setup

- name: Build
shell: bash
run: yarn build

- name: Set deployment token
run: npm config set '//registry.npmjs.org/:_authToken' "${{ secrets.NPM_TOKEN }}"

# https://github.com/changesets/action#with-publishing
- name: Handle Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
title: "chore: version packages 🔖"
commit: "chore: version packages 🔖"
publish: yarn release:publish
version: yarn release:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Add files here to ignore them from prettier formatting
/dist
.github
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "open-analytics",
"private": true,
"version": "0.0.0",
"type": "module",
"main": "./dist/open-analytics.umd.cjs",
Expand All @@ -19,7 +18,10 @@
"test": "vitest run",
"test:watch": "vitest",
"format": "prettier . --check",
"format:fix": "prettier . --write"
"format:fix": "prettier . --write",
"release:check": "changeset status --verbose --since=origin/master",
"release:publish": "yarn install && yarn build && changeset publish",
"release:version": "changeset version && yarn install --lockfile-only"
},
"devDependencies": {
"@types/node": "^20.4.6",
Expand All @@ -39,7 +41,9 @@
"typescript": "*",
"vite": "^4.4.5",
"vite-plugin-dts": "^3.4.0",
"vitest": "^0.34.1"
"vitest": "^0.34.1",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2"
},
"husky": {
"hooks": {
Expand Down
Loading

0 comments on commit c6ec0fe

Please sign in to comment.