Skip to content

Commit

Permalink
ci: update publish job
Browse files Browse the repository at this point in the history
  • Loading branch information
Dokuqui committed Feb 17, 2024
1 parent 9b8d6ed commit ea4e8f4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 62 deletions.
108 changes: 46 additions & 62 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- 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 }}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit ea4e8f4

Please sign in to comment.