From 0702182a84ed4949ae232826e6ceb72dee79458c Mon Sep 17 00:00:00 2001 From: Jack Wilburn Date: Fri, 26 Aug 2022 10:45:55 -0600 Subject: [PATCH] Add publishing workflow --- .github/workflows/main.yml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..fc1c301 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,39 @@ +name: CI + +on: + pull_request: + push: + # Run CI on all branch pushes. Must use this syntax, + # as we also need to run CI on tag pushes. + branches: + - "**" + tags: + - v[0-9]+.[0-9]+.[0-9]+* + +jobs: + build: + name: Build, lint, and publish + runs-on: ubuntu-latest + steps: + - name: Check out the repository + uses: actions/checkout@v3 + + - name: Set up Node environment + uses: actions/setup-node@v3 + with: + node-version: '16' + cache: yarn + + - name: Create a production build + run: yarn build + + - name: Get the publishing version number + id: version-number + run: echo "::set-output name=version::$(git describe --tags | tail -c +2)" + if: startsWith(github.ref, 'refs/tags/') + + - name: Publish the package + run: yarn publish --new-version ${{ steps.version-number.outputs.version }} --non-interactive --no-git-tag-version + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + if: startsWith(github.ref, 'refs/tags/') \ No newline at end of file