Skip to content

Commit

Permalink
add: release
Browse files Browse the repository at this point in the history
  • Loading branch information
appsaeed committed May 22, 2024
1 parent 58243ea commit 50f4b6a
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 20 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/npm-publish.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Node.js Publish Package

on:

# workflow_dispatch:

# push:
# branches:
# - main

release:
types: [published]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"

- run: npm config set registry https://registry.npmjs.org
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-github:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: https://npm.pkg.github.com/
# scope: "@appsaeed"

- run: npm config set registry https://npm.pkg.github.com
- run: npm run build
- run: |
node <<EOF
const fs = require('fs');
const pkg = require('./package.json');
const _content = { ...pkg, name: '@${{ github.repository }}' };
fs.writeFile('package.json', JSON.stringify(_content), 'utf-8', (err) => {
if (err) {
console.warn(err)
process.exit(0);
};
})
EOF
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: false
prerelease: false
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-svg",
"version": "1.0.4",
"version": "1.4.0",
"description": "Vite SVG plugin: effortless SVG import with support for various formats JSON, raw string, object, etc.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit 50f4b6a

Please sign in to comment.