Skip to content

Commit

Permalink
chore: Add release build script and release workflow (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatiPl01 authored Oct 27, 2023
1 parent 84ad7ca commit 70bcffa
Show file tree
Hide file tree
Showing 10 changed files with 337 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
babel.config.js
metro.config.js
bob.config.js
README.md
node_modules
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
workflow_dispatch:
push:
branches: [main]

jobs:
release:
name: 🚀 Release
runs-on: ubuntu-latest

permissions:
contents: write
packages: write

steps:
- name: 🛒 Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}

- name: 🛠 Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: 🔄 Generate Cache Key
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: 💾 Cache Dependencies
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: 📦 Install dependencies
run: yarn install --frozen-lockfile

- name: 🎉 Release
run: yarn semantic-release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ yarn-error.log

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

dist/
react-native-skia-responsive-text*.tgz
3 changes: 3 additions & 0 deletions .imgbotconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"prTitle": "chore(ImgBot): Optimize images"
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.6.1
58 changes: 58 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
}
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "angular",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
},
"writerOpts": {
"commitsSort": [
"subject",
"scope"
]
}
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
"@semantic-release/npm",
[
"@semantic-release/git",
{
"assets": [
"package.json",
"CHANGELOG.md"
],
"message": "release: ${nextRelease.version} \n\n${nextRelease.notes}"
}
],
"@semantic-release/github"
],
"preset": "angular"
}
5 changes: 5 additions & 0 deletions bob.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
source: 'src',
output: 'dist',
targets: ['commonjs', 'module']
};
26 changes: 25 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@
"syncpack": "^11.2.1",
"typescript": "^5.2.2"
},
"files": [
"src",
"dist",
"LICENSE",
"README.md",
"CHANGELOG.md"
],
"keywords": [
"android",
"animated-text",
"ios",
"react-native",
"react-native-skia",
"reanimated",
"responsive-text",
"skia",
"text"
],
"license": "MIT",
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
Expand All @@ -27,7 +45,8 @@
"syncpack format"
]
},
"main": "index.js",
"main": "dist/commonjs/index",
"module": "dist/module/index",
"peerDependencies": {
"@shopify/react-native-skia": ">=0.1.75",
"react": "*",
Expand All @@ -45,18 +64,23 @@
"react-native": "^0.72.5"
},
"scripts": {
"build": "yarn clean && bob build && yarn declarations:emit",
"clean": "rm -rf dist && rm -f *.tgz",
"declarations:emit": "tsc -p tsconfig.build.json",
"example": "yarn --cwd example workspace example start",
"example:android": "yarn workspace example android",
"example:ios": "yarn workspace example ios",
"format:code": "prettier --write . --ignore-unknown",
"format:deps": "syncpack format",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"prepack": "yarn build",
"prepare": "husky install",
"typecheck": "tsc -p tsconfig.json --noEmit",
"typecheck:all": "yarn typecheck && yarn typecheck:example",
"typecheck:example": "yarn workspace example typecheck"
},
"types": "dist/typescript/index.d.ts",
"workspaces": [
"example"
]
Expand Down
10 changes: 10 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist/types"
}
}
Loading

0 comments on commit 70bcffa

Please sign in to comment.