From 550405ffafaf471d6667d58ddc1d672d1abf9552 Mon Sep 17 00:00:00 2001 From: Murilo Cunha Date: Wed, 5 Jul 2023 09:52:19 +0200 Subject: [PATCH] add cicd --- .github/workflows/publish.yaml | 18 ++++++++++++++++++ .github/workflows/release.yaml | 21 +++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .github/workflows/publish.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..b84dfcf --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,18 @@ +name: Publish Package to npmjs +on: + push: + branches: [main] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 14 + registry-url: 'https://registry.npmjs.org' + - run: yarn version --new-version patch + - run: yarn + - run: yarn publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..0e35517 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,21 @@ +name: Publish Package to npmjs +on: + push: + tags: ['*'] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Create release + uses: actions/github-script@v5 + with: + github-token: ${{ github.token }} + script: | + github.rest.repos.createRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + tag_name: "${{ env.TAG }}", + generate_release_notes: true + })