From 658b6f1e045231f56f91c67d5e9c56b26cc15e96 Mon Sep 17 00:00:00 2001 From: Denys Dovhan Date: Tue, 2 Feb 2021 21:27:24 +0200 Subject: [PATCH] patch(semantic-release): Add semantic-release --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 28 +++++++++++++++++----------- package.json | 19 +++++++++++++++++++ 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 119ed0d..a7b8531 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: name: Test build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Build run: | npm install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ff7c62d..9afcaac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,13 +1,14 @@ name: Release on: - release: - types: [published] + push: + branches: + - master jobs: release: name: Prepare release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 # Build - name: Build the file run: | @@ -15,11 +16,16 @@ jobs: npm install npm run build # Upload build file to the release as an asset - - name: Upload zip to release - uses: svenstaro/upload-release-action@v1-release - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: /home/runner/work/purifier-card/purifier-card/dist/purifier-card.js - asset_name: purifier-card.js - tag: ${{ github.ref }} - overwrite: true + - name: Release + run: npx semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + # - name: Upload zip to release + # uses: svenstaro/upload-release-action@v1-release + # with: + # repo_token: ${{ secrets.GITHUB_TOKEN }} + # file: /home/runner/work/purifier-card/purifier-card/dist/purifier-card.js + # asset_name: purifier-card.js + # tag: ${{ github.ref }} + # overwrite: true diff --git a/package.json b/package.json index 3cc3b3b..46a95cc 100644 --- a/package.json +++ b/package.json @@ -52,5 +52,24 @@ "lint-staged": { "*.js": "eslint --fix", "*": "prettier --write" + }, + "release": { + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/npm", + [ + "@semantic-release/github", + { + "assets": [ + { + "path": "dist/purifier-card.js", + "label": "A Purifier card bundle file" + } + ] + } + ], + "@semantic-release/changelog" + ] } }