Skip to content
This repository has been archived by the owner on Dec 30, 2024. It is now read-only.

Commit

Permalink
added changesets
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioEstriga committed Oct 24, 2023
1 parent 4a2fd30 commit 772a411
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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)

## Adding a changeset

Use `npx changeset` to add a changeset. Pick the patch type that matches the changes you made (we use semantic versioning), and write a summary. This will be logged in a changeset file that you must commit to git. A recommended git message is of the form "docs(changeset): <summary>".

The changeset file is just markdown (after the frontmatter) and will be used to generate a changelog when we release.

Some changes do not (or should not) require a version bump. In order to log a changeset for such a change, use `npx changeset --blank` instead.
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": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
38 changes: 38 additions & 0 deletions .github/actions/install_and_cache_dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Install dependencies
author: Johannes L. Borresen
runs:
using: composite
steps:
- name: Setup Node.js

uses: actions/[email protected]
with:
node-version: "19"

# The steps that have been commented out are specific for caching the PNPM
# store (central dependency cache) between builds. It has been kept in case
# you want to use it.

# - name: Setup pnpm
# uses: pnpm/[email protected]
# with:
# run_install: false

# - name: Detect PNPM store directory
# shell: bash
# run: |
# echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

# - name: Setup cache
# uses: actions/cache@v3
# with:
# path: ${{ env.STORE_PATH }}
# key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
# restore-keys: |
# ${{ runner.os }}-pnpm-store-

# Note: if caching is re-introduced, avoid use of `npm ci` as this command
# removes node_modules before running.
- name: Install dependencies
shell: bash
run: npm i
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This file's workflow invokes changesets to generate and publish a release.
# If pushing to the master branch, the changesets action is used to maintain a
# release-specific pull request, and trigger an actual release if that PR is
# merged.
# If pushing to develop, a snapshot release is published to the @develop tag
# instead.

name: Release
on:
push:
branches:
- master
- develop

permissions: write-all

jobs:
# Run unit tests by calling the workflow in unit_tests.yml
unit_tests:
name: Unit tests
uses: ./.github/workflows/unit_tests.yml

release:
name: Release
runs-on: ubuntu-latest
# needs: unit_tests # Release step will ONLY run if unit tests complete.
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup (cache, dependencies)
uses: ./.github/actions/install_and_cache_dependencies

- name: Build
run: npm run build

# For stable branch, use changeset action to maintain a PR and finally
# publish when appropriate.
- name: Create release (or Pull Request)
if: github.ref_name == 'master'
uses: changesets/action@v1
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
publish: npm run release

# Snapshot releases don't need the changeset action to put together PRs.
- name: Create snapshot release
if: github.ref_name == 'develop'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
npm run build
npx changeset version --snapshot develop
npx changeset publish --tag develop
27 changes: 27 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

name: Unit Tests
on:
pull_request:
branches:
- develop
workflow_call:
inputs:
unused:
type: boolean
description: Unused, but it seems you must define *something* for workflow_call.

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup (cache, dependencies)
uses: ./.github/actions/install_and_cache_dependencies

- name: Build
run: npm run build

- name: Test
run: npm test
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"puppeteer-extra-plugin-stealth": "^2.11.2"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@qualweb/types": "0.7.22",
"@tsconfig/recommended": "^1.0.1",
"@types/node": "^17.0.19",
Expand Down

0 comments on commit 772a411

Please sign in to comment.