Skip to content

Commit

Permalink
feat: update to node20 (#22)
Browse files Browse the repository at this point in the history
* feat: node20 update

* feat: add basic test
  • Loading branch information
saionaro authored May 11, 2024
1 parent be0a1c1 commit 204f7ec
Show file tree
Hide file tree
Showing 8 changed files with 5,735 additions and 5,474 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/ci.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release

on: [push]

jobs:
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- run: npm ci
- run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test

on: [push]

env:
EXPECTED: "3.14.16"

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- run: npm ci
- run: mkdir ./test_1
- run: |
echo '{"version": "${{ env.EXPECTED }}"}' > ./test_1/package.json
- name: Test 1
id: package_ver
uses: ./
with:
path: ./test_1

- name: Check results
uses: actions/github-script@v7
env:
RECEIVED: ${{ steps.package_ver.outputs.version }}
with:
script: |
const { EXPECTED, RECEIVED } = process.env;
if (RECEIVED !== RECEIVED)
core.setFailed(`Expected [${EXPECTED}], but got [${RECEIVED}]`)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Artem Shibakov
Copyright (c) 2024 Artem Shibakov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
28 changes: 11 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ jobs:
name: Create Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master

- name: Extract version
id: extract_version
uses: Saionaro/[email protected]
# From now you can access the version
- name: Print version
run: echo ${{ steps.extract_version.outputs.version }}
- uses: actions/checkout@v4

- uses: saionaro/[email protected]
id: package_ver
# from now you can access the version
- run: echo ${{ steps.package_ver.outputs.version }}
```
### Example workflow - get NPM version of subdirectory (useful in monorepos)
Expand All @@ -47,15 +44,12 @@ jobs:
name: Create Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- uses: actions/checkout@v4

- name: Extract version
id: extract_version
uses: Saionaro/[email protected]
- uses: saionaro/[email protected]
id: package_ver
with:
path: mysubdir
# From now you can access the version
- name: Print version
run: echo ${{ steps.extract_version.outputs.version }}
# from now you can access the version
- run: echo ${{ steps.package_ver.outputs.version }}
```
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Extract Package Version
description: Extract Package Version for npm packages.
author: "Saionaro"
author: "saionaro"
inputs:
path:
description: "The directory where package.json can be found (defaults to root of repo)"
runs:
using: "node16"
using: "node20"
main: "dist/index.js"
branding:
icon: alert-circle
Expand Down
Loading

0 comments on commit 204f7ec

Please sign in to comment.