Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to bump version to stay in line with lucide #1

Merged
merged 5 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/actions/sync-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import fs from 'fs'

// Load the package.json file
let packageJson = fs.readFileSync('package.json');
let packageObj = JSON.parse(packageJson);

// Specify your dependency
let dependency = "lucide";

// Get the version of the dependency
let dependencyVersion = packageObj.dependencies[dependency];

// Update the version of your package
packageObj.version = dependencyVersion;

// Write the updated package.json file back to disk
fs.writeFileSync('package.json', JSON.stringify(packageObj, null, 2));
26 changes: 21 additions & 5 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
name: Run tests
name: Sync version with Lucide
on:
pull_request:
types: [opened]

jobs:
build:
update-version:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Automated Version Bump
id: version-bump
uses: 'phips28/gh-action-bump-version@master'
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org

- name: Install dependencies
run: yarn

- name: Sync version
run: node .github/actions/sync-version.js

- name: Commit and push if it changed
run: |
git diff
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "Sync version with dependency" || exit 0
git push
3 changes: 3 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
push:
branches:
- main
paths:
- 'package.json'

jobs:
build:
Expand All @@ -16,6 +18,7 @@ jobs:
registry-url: https://registry.npmjs.org
- run: yarn
- run: yarn build
- run: yarn test
- run: cd dist && yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Publish Package to NPM Registry
name: Run tests
on:
pull_request:
types: [opened, edited]
branches: [ main ]

jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
Loading