Skip to content

Commit

Permalink
chore: update ci scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Aug 21, 2023
1 parent 6299320 commit 6fec500
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 55 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on: [push, pull_request]

jobs:
build:
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -20,20 +18,3 @@ jobs:
- run: npm run build
- run: npm run test

- name: publish to npmjs
run: npm publish
if: startsWith(github.ref, 'refs/tags/v')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- uses: actions/setup-node@v3
with:
node-version-file: ".node-version"
registry-url: "https://npm.pkg.github.com"

- name: publish to github packages
run: npm publish
if: startsWith(github.ref, 'refs/tags/v')
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50 changes: 50 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build

on:
create:
tags:
- "v*"

jobs:
build:
permissions:
packages: write
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: ".node-version"
registry-url: "https://registry.npmjs.org"

- run: |
wget -P ${{ runner.temp }} https://github.com/tinygo-org/tinygo/releases/download/v0.28.1/tinygo_0.28.1_amd64.deb
yes | sudo dpkg -i ${{ runner.temp }}/tinygo_0.28.1_amd64.deb
- run: npm run build

- name: Publish to npmjs
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- uses: actions/setup-node@v3
with:
node-version-file: ".node-version"
registry-url: "https://npm.pkg.github.com"

- name: Publish to github packages
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Pack
run: npm pack

- name: Publish to Github Releases
uses: softprops/action-gh-release@c9b46fe7aad9f02afd89b12450b780f52dacfb2d
with:
files: |
*.tgz
73 changes: 37 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
{
"name": "@wasm-fmt/gofmt",
"author": "magic-akari <akari.ccino@gamil.com>",
"version": "0.3.1",
"description": "wasm based gofmt",
"main": "lib.js",
"types": "lib.d.ts",
"type": "module",
"exports": {
".": {
"types": "./lib.d.ts",
"default": "./lib.js"
"name": "@wasm-fmt/gofmt",
"author": "magic-akari <akari.ccino@gamil.com>",
"version": "0.3.1",
"description": "wasm based gofmt",
"main": "lib.js",
"types": "lib.d.ts",
"type": "module",
"exports": {
".": {
"types": "./lib.d.ts",
"default": "./lib.js"
},
"./vite": {
"types": "./lib.d.ts",
"default": "./vite.js"
},
"./package.json": "./package.json",
"./*": "./*"
},
"./vite": {
"types": "./lib.d.ts",
"default": "./vite.js"
"scripts": {
"go_wasm": "cp $(tinygo env TINYGOROOT)/targets/wasm_exec.js ./go_wasm.js",
"patch": "git apply ./go_wasm.patch",
"build": "tinygo build -o=lib.wasm -target=wasm -no-debug -stack-size=24kb ./src/lib.go",
"postbuild": "npm run go_wasm && npm run patch",
"test": "node --test"
},
"./package.json": "./package.json",
"./*": "./*"
},
"scripts": {
"go_wasm": "cp $(tinygo env TINYGOROOT)/targets/wasm_exec.js ./go_wasm.js",
"patch": "git apply ./go_wasm.patch",
"build": "tinygo build -o=lib.wasm -target=wasm -no-debug -stack-size=24kb ./src/lib.go",
"postbuild": "npm run go_wasm && npm run patch",
"test": "node --test"
},
"engines": {
"node": ">=16.17.0"
},
"keywords": [
"wasm",
"golang",
"formatter"
],
"license": "MIT",
"publishConfig": {
"access": "public"
}
"engines": {
"node": ">=16.17.0"
},
"keywords": [
"wasm",
"golang",
"formatter"
],
"license": "MIT",
"publishConfig": {
"access": "public",
"provenance": true
}
}

0 comments on commit 6fec500

Please sign in to comment.