Skip to content

.github/workflows/publish.yml #12

.github/workflows/publish.yml

.github/workflows/publish.yml #12

Workflow file for this run

on:
push:
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
- name: Install dependencies and build 🔧
run: npm ci && npm run build
- name: Run lint
run: npm run lint
- name: Run tests
run: npm run test
- name: Package module
run: npm pack
- name: Verify tag version is the same as package.json version
id: version
run: |
[ ${GITHUB_REF:11} = $(node -p "require('./package.json').version") ]
echo "version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT
- name: Upload package file
uses: actions/upload-artifact@v1
with:
name: esptool-js-${{ steps.version.outputs.version }}.tgz
path: esptool-js-${{ steps.version.outputs.version }}.tgz
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Espressif ESPTOOL-JS ${{ github.ref }}
draft: true
body: |
### Release Highlights
### Features & Enhancements
<!-- Insert The Features and Enhancements below as points possibly add the link to the PR/commit -->
### Bug Fixes
<!-- Insert The Bug Fixes below as points, also add relevant links -->
- name: Upload release
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./esptool-js-${{ steps.version.outputs.version }}.tgz
asset_name: esptool-js-${{ steps.version.outputs.version }}.tgz
asset_content_type: application/zip
- name: Publish package on NPM 📦
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}