Skip to content

Commit 8246cdc

Browse files
committed
ci: add publish workflow (#37)
1 parent c65f168 commit 8246cdc

File tree

4 files changed

+36
-62
lines changed

4 files changed

+36
-62
lines changed

.github/workflows/publish.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish
2+
3+
# Allow to run this workflow manually from the Actions tab
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
package:
8+
description: 'Package to publish'
9+
type: string
10+
required: true
11+
default: 'mikel'
12+
## Set permissions to the github token
13+
## https://github.com/softprops/action-gh-release#permissions
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
publish:
19+
if: ${{ github.repository == 'jmjuanes/mikel' }}
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 20
26+
registry-url: 'https://registry.npmjs.org'
27+
- name: Publish primary package
28+
run: npm publish
29+
if: ${{ inputs.package == 'mikel' }}
30+
env:
31+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
- name: Publish secondary package
33+
run: cd packages/${{ inputs.package }} && npm publish
34+
if: ${{ inputs.package != 'mikel' }}
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

-32
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,3 @@ jobs:
1818
- uses: softprops/action-gh-release@v2
1919
with:
2020
generate_release_notes: true
21-
22-
publish:
23-
name: Publish
24-
if: ${{ github.repository == 'jmjuanes/mikel' }}
25-
runs-on: ubuntu-latest
26-
steps:
27-
- uses: actions/checkout@v4
28-
- uses: actions/setup-node@v4
29-
with:
30-
node-version: 20
31-
registry-url: 'https://registry.npmjs.org'
32-
- run: npm publish
33-
env:
34-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35-
36-
publish-packages:
37-
name: Publish packages
38-
if: ${{ github.repository == 'jmjuanes/mikel' }}
39-
runs-on: ubuntu-latest
40-
strategy:
41-
matrix:
42-
package: [mikel-webpack-plugin]
43-
steps:
44-
- uses: actions/checkout@v4
45-
- uses: actions/setup-node@v4
46-
with:
47-
node-version: 20
48-
registry-url: 'https://registry.npmjs.org'
49-
- run: yarn release
50-
- run: cd packages/${{ matrix.package }} && npm publish
51-
env:
52-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"./package.json": "./package.json"
1818
},
1919
"scripts": {
20-
"release": "node scripts/release.js",
2120
"test": "node test.js"
2221
},
2322
"keywords": [

scripts/release.js

-29
This file was deleted.

0 commit comments

Comments
 (0)