From 4242ca941840ba198597c45ec67d8bbd816700a2 Mon Sep 17 00:00:00 2001 From: Jon Friesen Date: Fri, 5 Jan 2024 10:07:09 -0700 Subject: [PATCH] adds new gh action workflows --- .github/workflows/pr.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/release.yml | 35 +++++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..6ed90fc --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,30 @@ +name: Build & Test + +on: + pull_request: + push: + branches: + - main + +jobs: + build: + name: build & test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20.x" + registry-url: 'https://registry.npmjs.org/' + + - name: Install Node dependencies + run: npm ci + + - name: Run Node build (if present) + run: npm run build --if-present + + - name: Run Tests (if present) + run: npm test --if-present diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bbf73dc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release +on: + push: + tags: + - "v*" + +jobs: + release: + name: release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20.x" + registry-url: 'https://registry.npmjs.org/' + + - name: Install Node dependencies + run: npm ci + + - name: Update version in package.json + run: | + TAG_VERSION=${GITHUB_REF#refs/tags/} + npm version $TAG_VERSION --no-git-tag-version + + - name: Run Node build (if present) + run: npm run build --if-present + + - name: Publish NPM package + run: npm publish --access=public + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/package.json b/package.json index 5673239..a824159 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@qpoint/replace-content", - "version": "0.2.0", + "version": "0.0.0", "description": "A Qpoint adapter for replacing content in the response html", "author": "Tyler Flint ", "homepage": "https://github.com/qpoint-io/qpoint-replace-content",