Skip to content

Commit

Permalink
add publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ukorvl committed Jun 25, 2024
1 parent 2a9af74 commit e30c97f
Show file tree
Hide file tree
Showing 10 changed files with 941 additions and 34 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file is for unifying the coding style for different editors and IDEs
# For vscode support install EditorConfig for VS Code plugin
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
14 changes: 14 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Build"
description: "Lint, test and build the project."

runs:
using: "composite"
steps:
- name: Lint
shell: bash
run: npm run lint
- name: Build
shell: bash
run: |
npm run build
ls -lh dist
20 changes: 20 additions & 0 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Install dependencies"
description: "Prepare repository and all dependencies"

inputs:
node_version:
description: "Node.js version"
required: true

runs:
using: "composite"
steps:
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node_version }}
- name: Install dependencies
shell: bash
run: |
export SKIP_INSTALL_SIMPLE_GIT_HOOKS=1
npm ci
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build
on:
pull_request:
workflow_dispatch:
push:
branches:
- master
- main

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build on Node.js ${{ matrix.version }}
runs-on: ubuntu-latest
strategy:
matrix:
version: [18, 20, 22]
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/install
with:
node_version: ${{ matrix.version }}
- name: Build
uses: ./.github/actions/build
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish

on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
publish:
name: Version Pull Request
runs-on: ubuntu-latest
permissions:
id-token: write
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/install
with:
node_version: 20
- name: Build
uses: ./.github/actions/build
- name: Publish
shell: bash
run: |
npm run publish
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
node_modules
.env
.idea
dist/
dist/
.vscode/*
!.vscode/settings.json
.tsbuildinfo
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"lineWidth": 80
},
"files": {
"ignore": ["node_modules", "dst"]
"ignore": ["node_modules", "dist"]
}
}
Loading

0 comments on commit e30c97f

Please sign in to comment.