From 7c6ba42d25651f44e5cbc21e603db9b28a214581 Mon Sep 17 00:00:00 2001 From: przemekrEP Date: Tue, 23 Jan 2024 14:52:44 +0100 Subject: [PATCH 1/3] Add GHA build, rename scope to @evidenceprime --- .github/workflows/ci.yml | 23 ------------------ .github/workflows/cicd.yaml | 47 +++++++++++++++++++++++++++++++++++++ .npmrc.tpl | 13 ---------- Dockerfile | 22 ----------------- azure-pipelines.yaml | 40 ------------------------------- dist/package.json | 4 ++-- package.json | 4 ++-- 7 files changed, 51 insertions(+), 102 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/cicd.yaml delete mode 100644 .npmrc.tpl delete mode 100644 Dockerfile delete mode 100644 azure-pipelines.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 910c8cf..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: ci -'on': - - push - - pull_request -jobs: - test: - name: Node ${{ matrix.node }} / ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - node: - - '14' - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: ${{ runner.node }} - - run: npm install - - run: npm run build --if-present - - run: npm test diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml new file mode 100644 index 0000000..1a6c6c3 --- /dev/null +++ b/.github/workflows/cicd.yaml @@ -0,0 +1,47 @@ +on: + push: + branches: + - master-gha + pull_request: + branches: + - master + workflow_dispatch: + +jobs: + buildAndPublish: + name: Build and publish to NPM (GH) + runs-on: ubuntu-22.04 + permissions: + checks: write + contents: read + packages: write + statuses: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: 'yarn' + registry-url: https://npm.pkg.github.com + - name: Install dependencies + run: yarn --frozen-lockfile + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Build + run: yarn build + - name: Release + if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} + run: yarn release + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Notify Google Chat + uses: evidenceprime/google-chat-notifications@master + if: ${{ always() && github.event_name == 'push' }} + with: + title: "Buffer" + subtitle: ${{ github.event.head_commit.message }} + webhookUrl: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }} + threadKey: QexDHE9oqjI + status: ${{ job.status }} \ No newline at end of file diff --git a/.npmrc.tpl b/.npmrc.tpl deleted file mode 100644 index c839846..0000000 --- a/.npmrc.tpl +++ /dev/null @@ -1,13 +0,0 @@ -@ep:registry=https://pkgs.dev.azure.com/evidence-prime/GRADEpro/_packaging/npm-02/npm/registry/ - -always-auth=true - -; begin auth token -//pkgs.dev.azure.com/evidence-prime/GRADEpro/_packaging/npm-02/npm/registry/:username=evidence-prime -//pkgs.dev.azure.com/evidence-prime/GRADEpro/_packaging/npm-02/npm/registry/:_password=NPM_TOKEN -//pkgs.dev.azure.com/evidence-prime/GRADEpro/_packaging/npm-02/npm/registry/:email=admin@evidenceprime.com -//pkgs.dev.azure.com/evidence-prime/GRADEpro/_packaging/npm-02/npm/:username=evidence-prime -//pkgs.dev.azure.com/evidence-prime/GRADEpro/_packaging/npm-02/npm/:_password=NPM_TOKEN -//pkgs.dev.azure.com/evidence-prime/GRADEpro/_packaging/npm-02/npm/:email=admin@evidenceprime.com -; end auth token - diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index d435b98..0000000 --- a/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM node:14.18.0-bullseye-slim - -RUN apt-get update && apt-get install git bzip2 python build-essential -y - -RUN mkdir /home/build -WORKDIR /home/build - -ARG UID=45006 -RUN adduser --disabled-password --no-create-home --uid $UID --gecos '' build - -ARG npm_token - -ADD .npmrc.tpl /root/ -RUN sed -i 's/NPM_TOKEN/'"$npm_token"'/' /root/.npmrc.tpl -RUN mv /root/.npmrc.tpl .npmrc - -COPY . . -RUN chown -R build:build /home/build -USER build - -RUN yarn install -RUN npm run release diff --git a/azure-pipelines.yaml b/azure-pipelines.yaml deleted file mode 100644 index 76a7f69..0000000 --- a/azure-pipelines.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: publish-npm -trigger: -- main -pr: none - -resources: -- repo: self - -variables: - infraSubscription: '09ff12e9-71e0-4ae8-884b-c811bfd06c7c' - infraKeyVault: 'evidenceprimeinfravault' - keyVaultFilter: 'mdg-pipeline-npm-token' - infraServiceConnection: "evidenceprime-infra" - -stages: -- stage: Publish - displayName: Pubish to npm - jobs: - - job: Publish - displayName: Publish - pool: - name: Default - demands: - - couchdb - steps: - - checkout: self - clean: true - - task: AzureKeyVault@2 - inputs: - ConnectedServiceName: '$(infraServiceConnection)' - KeyVaultName: '$(infraKeyVault)' - SecretsFilter: '$(keyVaultFilter)' - RunAsPreJob: false - - task: Docker@2 - inputs: - command: build - Dockerfile: '$(Build.SourcesDirectory)/Dockerfile' - buildContext: '.' - arguments: --build-arg npm_token="$(mdg-pipeline-npm-token)" - diff --git a/dist/package.json b/dist/package.json index 2265669..dfa0f60 100644 --- a/dist/package.json +++ b/dist/package.json @@ -1,7 +1,7 @@ { - "name": "@ep/buffer", + "name": "@evidenceprime/buffer", "description": "Node.js Buffer API, for the browser", - "version": "6.0.9", + "version": "6.0.10", "main": "./buffer.js", "engines": { "node": ">=8.0" diff --git a/package.json b/package.json index 0248912..7d6550b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "@ep/buffer", + "name": "@evidenceprime/buffer", "description": "Node.js Buffer API, for the browser", - "version": "6.0.9", + "version": "6.0.10", "author": { "name": "Feross Aboukhadijeh", "email": "feross@feross.org", From c5c440b03b8cf14b811b275dcfb28d02c218daf0 Mon Sep 17 00:00:00 2001 From: przemekrEP Date: Tue, 23 Jan 2024 14:56:37 +0100 Subject: [PATCH 2/3] cleanup --- .github/workflows/cicd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 1a6c6c3..4f5588b 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -1,7 +1,7 @@ on: push: branches: - - master-gha + - master pull_request: branches: - master From d11f7ffa2d525f2b819323dc3aa767998c37e060 Mon Sep 17 00:00:00 2001 From: przemekrEP Date: Tue, 23 Jan 2024 15:13:34 +0100 Subject: [PATCH 3/3] remove checks, statuses permissions --- .github/workflows/cicd.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 4f5588b..0369289 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -12,10 +12,8 @@ jobs: name: Build and publish to NPM (GH) runs-on: ubuntu-22.04 permissions: - checks: write contents: read packages: write - statuses: write steps: - name: Checkout repository uses: actions/checkout@v3 @@ -44,4 +42,4 @@ jobs: subtitle: ${{ github.event.head_commit.message }} webhookUrl: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }} threadKey: QexDHE9oqjI - status: ${{ job.status }} \ No newline at end of file + status: ${{ job.status }}