Skip to content

Commit

Permalink
Update release action (#1011)
Browse files Browse the repository at this point in the history
  • Loading branch information
ije authored Jan 13, 2025
1 parent 1ad31b6 commit 1ad9072
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
registry-url: 'https://registry.npmjs.org'

- name: Build CLI
run: go build -ldflags="-s -w -X 'github.com/esm-dev/esm.sh/server.VERSION=${{ github.ref_name }}'" -o cli/tmp/bin/esm.sh-cli-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }} cli/cmd/main.go
run: go build -ldflags="-s -w -X 'github.com/esm-dev/esm.sh/server.VERSION=${{ github.ref_name }}'" -o cli/build/bin/esm.sh-cli-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }} cli/cmd/main.go
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
Expand All @@ -120,12 +120,18 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: esm.sh-cli-${{ matrix.os }}-${{ matrix.arch }}
path: cli/tmp/bin/esm.sh-cli-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}
path: cli/build/bin/esm.sh-cli-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}
if-no-files-found: error

- name: Create package.json
run: echo "const[minor,patch='0']='${{ github.ref_name }}'.slice(1).split('_');const p=JSON.parse(require('fs').readFileSync('../npm/package.json','utf8'));console.log(JSON.stringify({...p,name:'@esm.sh/cli-${{ matrix.os }}-${{ matrix.arch }}',version:['0',minor,patch].join('.'),os:['${{ matrix.os }}'],cpu:['${{ matrix.arch }}'.replace('amd','x')],bin:void 0,scripts:void 0,optionalDependencies:void 0}))" | node > package.json
working-directory: cli/tmp
working-directory: cli/build

- name: Publish Package to NPM
run: npm publish --provenance --access public
working-directory: cli/build
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish_esmsh_to_npm:
name: Publish package "esm.sh" to NPM
Expand All @@ -151,6 +157,12 @@ jobs:
run: echo "const fs=require('fs');const[minor,patch='0']='${{ github.ref_name }}'.slice(1).split('_');fs.writeFileSync('package.json',fs.readFileSync('package.json','utf8').replaceAll('*',['0',minor,patch].join('.')),'utf8')" | node
working-directory: cli/npm

- name: Publish Package
run: npm publish --provenance --access public
working-directory: cli/npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

release:
name: Release
runs-on: ubuntu-latest
Expand Down

0 comments on commit 1ad9072

Please sign in to comment.