ci: automatically create new releases with tags instead of each push to master

Resolves #111
This commit is contained in:
Sam Marks 2022-03-09 19:32:29 -05:00
parent 0b6d2ff264
commit 5f6ef02585
5 changed files with 43 additions and 16 deletions

View file

@ -26,10 +26,6 @@ jobs:
version: 6.27.1
run_install: true
- run: pnpm run build
- run: pnpm run prepublish
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update build artifacts and release
- run: pnpm -r publish --filter ./packages --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
commit_message: Update build artifacts

38
.github/workflows/release.yaml vendored Normal file
View file

@ -0,0 +1,38 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: actions/setup-node@v2
with:
node-version: '14'
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v2.1.0
with:
version: 6.27.1
run_install: true
- run: pnpm run prepublish
env:
TAG_NAME: ${{ github.ref_name }}
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Release Version
tagging_message: ${{ github.ref_name }}
push_options: '--force'
- run: pnpm -r publish --filter ./packages --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View file

@ -1,20 +1,17 @@
import { execSync } from 'child_process';
import semver from 'semver';
import path from 'path';
import fs from 'fs';
const BASE_VERSION = '2.1.0';
const PACKAGE_BASE = '';
function publishPackage(name) {
console.info('Publishing %s', name);
const currentVersion =
execSync(`npm view ${name} version`).toString() || BASE_VERSION;
console.info('Current version is %s', currentVersion);
const newVersion = semver.inc(currentVersion, 'minor');
const newVersion = semver.valid(semver.coerce(process.env.TAG_NAME));
console.info('New version is %s', newVersion);
if (!newVersion) {
throw new Error(`Tag name ${process.env.TAG_NAME} is not valid.`);
}
const packageJsonPath = path.join('packages', name, 'package.json');
const contents = JSON.parse(fs.readFileSync(packageJsonPath).toString());

View file

@ -8,8 +8,6 @@ Iconoir is an open source library with 900+ SVG Icons. No premium icons, no emai
`iconoir-react-native` is an open source package that exports these icons as React Native components (`react-native-svg`) that can be used in all of your React Native projects.
**Based on Iconoir Icons ```v4.4.0```.**
### Installation
```

View file

@ -8,8 +8,6 @@ Iconoir is an open source library with 900+ SVG Icons. No premium icons, no emai
`iconoir-react` is an open source package that exports these icons as React.js components that can be used in all of your React projects.
**Based on Iconoir Icons ```v4.4.0```.**
### Installation
```