Skip to content

Commit 8e105dd

Browse files
authored
Merge pull request #388 from brainstormforce/publish-workflow
Publish a new workflow for duplicating mirror image at brainstormforce/bsf-admin-ui
1 parent 31f97a2 commit 8e105dd

4 files changed

Lines changed: 121 additions & 2 deletions

File tree

.editorconfig

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
# WordPress Coding Standards
5+
# https://make.wordpress.org/core/handbook/coding-standards/
6+
7+
root = true
8+
9+
[*]
10+
charset = utf-8
11+
end_of_line = lf
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
indent_style = tab
15+
indent_size = 4
16+
17+
[{.jshintrc,*.json,*.yml}]
18+
indent_style = space
19+
indent_size = 2
20+
21+
[{.editorconfig,*.md,*.txt,*.xml,*.yml}]
22+
indent_style = space
23+
indent_size = 2
24+
25+
[{.gitattributes,*.gitignore,*.gitmodules}]
26+
indent_style = space
27+
indent_size = 2
28+
29+
[package.json]
30+
indent_style = tab
31+
32+
[*.md]
33+
trim_trailing_whitespace = false
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Publish Public Build
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish-build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: '18'
17+
18+
# Build the library
19+
- name: Install and Build
20+
run: |
21+
npm ci
22+
npm run build
23+
24+
# Push to public mirror repo
25+
- name: Push Build to Public Mirror
26+
env:
27+
FORCE_UI_TOKEN: ${{ secrets.FORCE_UI_TOKEN }}
28+
run: |
29+
# Clone public mirror repo
30+
git clone https://x-access-token:${{ secrets.FORCE_UI_TOKEN }}@github.com/brainstormforce/bsf-admin-ui.git build-repo
31+
32+
cd build-repo
33+
34+
# Clear old dist
35+
rm -rf dist
36+
37+
# Copy new build
38+
cp -r ../dist ./
39+
40+
# Update version in package.json
41+
VERSION=$(node -p "require('../package.json').version")
42+
node -e "
43+
const pkg = require('./package.json');
44+
pkg.version = '$VERSION';
45+
require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));
46+
"
47+
48+
# Commit and tag
49+
git config user.name github-actions
50+
git config user.email github-actions@github.com
51+
git add dist package.json
52+
git commit -m "Release v$VERSION - build artifacts only"
53+
git tag v$VERSION
54+
git push origin master
55+
git push origin v$VERSION

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: '18'
19+
registry-url: 'https://npm.pkg.github.com'
20+
scope: '@brainstormforce'
21+
22+
- run: npm ci
23+
- run: npm run build
24+
25+
- run: npm publish
26+
env:
27+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
{
2-
"name": "@bsf/force-ui",
2+
"name": "@brainstormforce/force-ui",
33
"version": "1.7.7",
44
"description": "Library of components for the BSF project",
55
"main": "./dist/force-ui.cjs.js",
66
"module": "./dist/force-ui.es.js",
77
"types": "./dist/force-ui.d.ts",
88
"type": "module",
99
"sideEffects": false,
10+
"publishConfig": {
11+
"registry": "https://npm.pkg.github.com",
12+
"access": "restricted"
13+
},
1014
"exports": {
1115
"./package.json": "./package.json",
1216
".": {
@@ -41,7 +45,7 @@
4145
},
4246
"repository": {
4347
"type": "git",
44-
"url": "git+https://github.com/rahulvarma722/bsf-admin-ui.git"
48+
"url": "git+https://github.com/brainstormforce/force-ui.git"
4549
},
4650
"volta": {
4751
"node": "18.15.0"

0 commit comments

Comments
 (0)