From ea4e8f4d3273befe90ddfda6e99d2e2f8cd85381 Mon Sep 17 00:00:00 2001 From: Illia Date: Sun, 18 Feb 2024 00:39:34 +0100 Subject: [PATCH] ci: update publish job --- .github/workflows/main.yml | 108 ++++++++++++++++--------------------- package.json | 4 ++ 2 files changed, 50 insertions(+), 62 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 205b27a..74d83fa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,79 +10,63 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '20.11.1' - - - name: Install dependencies - run: npm install - - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: | - ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - - name: Save dependencies cache - if: success() - run: | - npm ci - mkdir -p ~/.npm - cp -R node_modules ~/.npm/ + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '20.11.1' + + - name: Install dependencies + run: npm ci + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: | + ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Save dependencies cache + if: success() + run: | + mkdir -p ~/.npm + cp -R node_modules ~/.npm/ test: runs-on: ubuntu-latest needs: install steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '20.11.1' + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: | + ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - - name: Restore dependencies cache - uses: actions/cache@v2 - with: - path: | - ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- + - name: Install dependencies + run: npm ci - - name: Install dependencies - run: npm ci - - - name: Run unit tests - run: npm run test-coverage + - name: Run unit tests + run: npm run test-coverage publish: runs-on: ubuntu-latest needs: test steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '20.11.1' - - - name: Install Semantic Release - run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog @semantic-release/npm - - - name: Run Semantic Release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npx semantic-release \ No newline at end of file + - name: Install Dependencies + uses: actions/setup-node@v3 + with: + node-version: '20.11.1' + + - name: Publish to npm + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 657e4f2..19bcd52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,10 @@ { "type": "module", "name": "@dokuqui/semantic-release-force-version", + "repository": { + "type": "git", + "url": "https://github.com/Dokuqui/Semantic-release_Force-version-plugin.git" + }, "version": "1.0.0", "description": "Semantic-release plugin to force your version", "main": "index.js",