Skip to content

Commit e2946eb

Browse files
authored
Create npm-publish-github-packages.yml
npm publish and artifact Signed-off-by: nholtman <nholtman@a-vision.nu>
1 parent 1476259 commit e2946eb

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish package to GitHub Packages
2+
on:
3+
release:
4+
types: [published]
5+
push:
6+
branches:
7+
- main
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
packages: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
# Setup .npmrc file to publish to GitHub Packages
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: '20.x'
20+
registry-url: 'https://npm.pkg.github.com'
21+
# Defaults to the user or organization that owns the workflow file
22+
scope: '@A-VISION-BV'
23+
- run: npm ci
24+
- run: grunt
25+
26+
- name: create new version var
27+
run: |
28+
NEW_VERSION=$(node -p "require('./package-lock.json').version")
29+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
30+
31+
- name: Create ZIP package
32+
run: |
33+
NEW_VERSION=${{ env.NEW_VERSION }}
34+
cd dist && zip -r ../mediaelement-plugins-dist-${NEW_VERSION}.zip ./
35+
36+
- name: Create a new draft release
37+
uses: ncipollo/release-action@v1
38+
with:
39+
tag: ${{ env.NEW_VERSION }}
40+
name: ${{ env.NEW_VERSION }}
41+
artifactErrorsFailBuild: true
42+
artifacts: "mediaelement-plugins-dist-${{ env.NEW_VERSION }}.zip"
43+
draft: true
44+
generateReleaseNotes: true
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
- run: npm publish
48+
env:
49+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)