From c508fe7d308c72f71f8c84247d791eabf2d085f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20V=C4=83n=20Nguy=C3=AAn?= Date: Tue, 5 Sep 2023 10:19:34 +0700 Subject: [PATCH] Create release action --- .github/workflows/create-release.yml | 30 +++++++++++++++++++++++++++ .github/workflows/publish-release.yml | 30 +++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 .github/workflows/create-release.yml create mode 100644 .github/workflows/publish-release.yml diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..aa006a1 --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,30 @@ +on: + push: + tags: + - "v*" + +name: Create Release + +jobs: + create-release: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup + + - name: Build package + run: yarn prepack + + - uses: actions/create-release@v1 + id: create_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: true + \ No newline at end of file diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..b84cb47 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,30 @@ +name: Publish Release +on: + release: + types: + - published + +jobs: + publish-release: + name: Publish Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup + + - name: Build package + run: yarn prepack + + - name: Publish + run: | + npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} + if [[ "${{ github.event.release.tag_name }}" == *"beta"* ]]; then + npm publish --tag beta + else + npm publish + fi + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }}