From 102cf61030f5cb13db86c4a65971dcd42b6f2cae Mon Sep 17 00:00:00 2001 From: Brian Ignacio Date: Mon, 28 Nov 2022 14:06:22 +0800 Subject: [PATCH] add ci basic flow update node version on publish fix ci workflow get version from package json package version fix env var use github ref on publish fix publish github ref fix publish version --- .github/workflows/ci.yml | 36 +++++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 4 ++-- 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1d47707 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + ci: + 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: Determine version + id: version + run: | + ESPTOOLJS_VERSION=$(node -p "require('./package.json').version") + echo $ESPTOOLJS_VERSION + echo "version=$ESPTOOLJS_VERSION" >> $GITHUB_OUTPUT + - name: Upload npm package file + uses: actions/upload-artifact@v1 + with: + name: esptool-js-${{ steps.version.outputs.version }}.tgz + path: esptool-js-${{ steps.version.outputs.version }}.tgz \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 621dcbd..205a4e2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '14.x' + node-version: 16 registry-url: 'https://registry.npmjs.org' - name: Install dependencies and build 🔧 run: npm ci && npm run build @@ -22,7 +22,7 @@ jobs: run: npm pack - name: Determine version id: version - run: "echo ::set-output name=version::${GITHUB_REF:11}" + run: echo "version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT - name: Upload npm package file uses: actions/upload-artifact@v1 with: