From 8bfbb54f5b1a47627cbf9c3d5dcb3b3791e63a0f Mon Sep 17 00:00:00 2001 From: aacerox Date: Mon, 9 Oct 2023 12:11:05 +0200 Subject: [PATCH] refactor: correct github folder ci: add github actions --- .github/workflows/nrc-build-test.yml | 22 +++++++++++++++++ .github/workflows/nrc-ci.yml | 23 +++++++++++++++++ .github/workflows/nrc-pr.yml | 8 ++++++ .github/workflows/nrc-publish.yml | 37 ++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 .github/workflows/nrc-build-test.yml create mode 100644 .github/workflows/nrc-ci.yml create mode 100644 .github/workflows/nrc-pr.yml create mode 100644 .github/workflows/nrc-publish.yml diff --git a/.github/workflows/nrc-build-test.yml b/.github/workflows/nrc-build-test.yml new file mode 100644 index 0000000..209e646 --- /dev/null +++ b/.github/workflows/nrc-build-test.yml @@ -0,0 +1,22 @@ +on: + workflow_call: +jobs: + build-test: + runs-on: ubuntu-latest + outputs: + semVer: ${{ steps.gitversion.outputs.semVer }} + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.x + cache: 'npm' + # clean install + - run: npm ci + # build + - run: npm run build --if-present + # test + - run: npm test + + diff --git a/.github/workflows/nrc-ci.yml b/.github/workflows/nrc-ci.yml new file mode 100644 index 0000000..d994785 --- /dev/null +++ b/.github/workflows/nrc-ci.yml @@ -0,0 +1,23 @@ +name: Node-Rest-Client CI +on: + push: + branches: + - release +jobs: + build-test: + uses: ./.github/workflows/nrc-build-test.yml + publish-npm: + needs: build-test + runs-on: ubuntu-latest + env: + SEM_VERSION: ${{ needs.build-test.outputs.semVer }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18.x + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.github/workflows/nrc-pr.yml b/.github/workflows/nrc-pr.yml new file mode 100644 index 0000000..1b6b593 --- /dev/null +++ b/.github/workflows/nrc-pr.yml @@ -0,0 +1,8 @@ +name: Node-Rest-Client PR +on: + pull_request: + branches: + - master +jobs: + build-test: + uses: ./.github/workflows/nrc-build-test.yml \ No newline at end of file diff --git a/.github/workflows/nrc-publish.yml b/.github/workflows/nrc-publish.yml new file mode 100644 index 0000000..53a9359 --- /dev/null +++ b/.github/workflows/nrc-publish.yml @@ -0,0 +1,37 @@ +on: + workflow_call: +jobs: + build-test: + runs-on: ubuntu-latest + outputs: + semVer: ${{ steps.gitversion.outputs.semVer }} + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.x + cache: 'npm' + # install git version + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0 + with: + versionSpec: '5.x' + preferLatestVersion: true + # calculate git version + - name: calculate semver + id: gitversion # id to later be referenced + uses: gittools/actions/gitversion/execute@v0 + + # clean install + - run: npm ci + # build + - run: npm run build --if-present + # test + - run: npm publish + env: + semVersion: my_value + # tag release + + +