Skip to content

Commit

Permalink
chore: change CI
Browse files Browse the repository at this point in the history
  • Loading branch information
krboktv committed Aug 21, 2024
1 parent d7b6b63 commit 4da0df2
Show file tree
Hide file tree
Showing 3 changed files with 1,412 additions and 1,101 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Publish package

on:
push:
tags:
- v*.*.*
workflow_dispatch:

jobs:
publish-to-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
scope: ${{ github.repository_owner }}
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Publish 🚀
run: pnpm publish --no-git-checks --access=public
working-directory: dist
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

publish-to-github:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Auth in GitHub private registry npm
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
echo "@1inch:registry=https://npm.pkg.github.com" >> .npmrc
- name: Publish 🚀
run: pnpm publish --no-git-checks
working-directory: dist
25 changes: 9 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish new version
name: Release new version

on:
workflow_dispatch:
Expand All @@ -17,6 +17,7 @@ jobs:
permissions:
contents: write
packages: write
actions: write
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -36,16 +37,8 @@ jobs:
node-version: 18
cache: pnpm

- name: Auth in GitHub private registry npm
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
echo "@1inch:registry=https://npm.pkg.github.com" >> .npmrc
- name: Install Dependencies
run: pnpm install

- name: Security
run: pnpm audit
- name: Install Dev Dependencies
run: pnpm install -D

- name: Bump package.json version
id: version
Expand All @@ -57,11 +50,6 @@ jobs:
- name: Generate changelog
run: pnpm changelog:generate -t v${{ steps.version.outputs.OLD_VERSION }} || pnpm changelog:generate

- name: Publish
run: pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create github release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -74,3 +62,8 @@ jobs:
git push
git push --tags
gh release create v${{ steps.version.outputs.NEW_VERSION }} --notes-file CHANGELOG.md
- name: Trigger publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run publish.yml -r v${{ steps.version.outputs.NEW_VERSION }}
Loading

0 comments on commit 4da0df2

Please sign in to comment.