-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
test-default: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- id: run | ||
uses: ./ | ||
|
||
- run: test -n "${{ steps.run.outputs.node-build-version }}" | ||
- run: test "${{ steps.run.outputs.node-version }}" = "$(< .node-version)" | ||
|
||
test-with-path: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- id: run | ||
uses: ./ | ||
with: | ||
node-version-path: .nvmrc | ||
|
||
- run: test -n "${{ steps.run.outputs.node-build-version }}" | ||
- run: test "${{ steps.run.outputs.node-version }}" = "$(< .nvmrc)" | ||
|
||
test-with-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- id: run | ||
continue-on-error: true | ||
uses: ./ | ||
with: | ||
node-version: 999.999.999 | ||
|
||
- run: test -n "${{ steps.run.outputs.node-build-version }}" | ||
- run: test "${{ steps.run.outputs.node-version }}" = "999.999.999" | ||
- run: test "${{ steps.run.outcome }}" = "failure" | ||
|
||
release: | ||
needs: | ||
- test-default | ||
- test-with-path | ||
- test-with-version | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: cycjimmy/semantic-release-action@v4 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: tag | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
- edited | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: Actions-R-Us/actions-tagger@v2 | ||
with: | ||
publish_latest_tag: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20.8.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20.8.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
[![Test](https://github.com/matzkoh/check-node-version/actions/workflows/default.yml/badge.svg)](https://github.com/matzkoh/check-node-version/actions/workflows/default.yml) | ||
|
||
# matzkoh/check-node-version | ||
|
||
This GitHub Action checks if commands like `nodenv install` will definitely succeed. | ||
|
||
It checks the `node-build` repository, which is the source of the installation, and fails if the target version does not exist. | ||
|
||
## Examples | ||
|
||
### Basic | ||
|
||
```yaml | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: /.node-version | ||
sparse-checkout-cone-mode: false | ||
|
||
- uses: matzkoh/check-node-version@v1 | ||
``` | ||
### Optional | ||
```yaml | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: /.node-version | ||
sparse-checkout-cone-mode: false | ||
|
||
- id: check-node-version | ||
continue-on-error: true # continue even if the node version is not yet released | ||
uses: matzkoh/check-node-version@v1 | ||
with: | ||
node-version-path: .nvmrc # use a file other than `.node-version` if desired | ||
|
||
- run: echo ${{ steps.check-node-version.outcome == 'success' && 'released 😀' || 'not yet released 😢' }} | ||
``` | ||
## Inputs | ||
See [action.yml](action.yml) | ||
| Name | Description | Default | Required | | ||
| ------------------- | ------------------------------------------------------------------- | --------------- | -------- | | ||
| `node-version-path` | Path to the file containing the node version to check | `.node-version` | ❌ | | ||
| `node-version` | Node version to check. If not specified, it will be read from file. | | ❌ | | ||
|
||
## Outputs | ||
|
||
See [action.yml](action.yml) | ||
|
||
| Name | Description | | ||
| -------------------- | -------------------------------------------------------------------- | | ||
| `node-version` | Same as `node-version` input. Checked version. | | ||
| `node-build-version` | Latest release version of brew `node-build` formula used for checks. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: check-node-version | ||
description: GitHub Actions to check if node-version has been released and is available via brew node-build. | ||
author: matzkoh | ||
|
||
inputs: | ||
node-version: | ||
description: The version to check | ||
node-version-path: | ||
description: The path to the .node-version file | ||
default: .node-version | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- id: check | ||
shell: bash | ||
run: | | ||
if [ -n "${{ inputs.node-version }}" ]; then | ||
node_version=${{ inputs.node-version }} | ||
else | ||
node_version=$(< ${{ inputs.node-version-path }}) | ||
fi | ||
node_build_version=$(curl -s 'https://formulae.brew.sh/api/formula/node-build.json' | jq -r '.versions.stable') | ||
echo "node-version=${node_version}" >> $GITHUB_OUTPUT | ||
echo "node-build-version=${node_build_version}" >> $GITHUB_OUTPUT | ||
curl -fsIo /dev/null "https://raw.githubusercontent.com/nodenv/node-build/v${node_build_version}/share/node-build/${node_version}" | ||
outputs: | ||
node-version: | ||
description: The version in .node-version | ||
value: ${{ steps.check.outputs.node-version }} | ||
node-build-version: | ||
description: The latest node-build version | ||
value: ${{ steps.check.outputs.node-build-version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** @type {import('semantic-release').GlobalConfig} */ | ||
module.exports = { | ||
branches: ['main'], | ||
plugins: [ | ||
'@semantic-release/commit-analyzer', | ||
'@semantic-release/release-notes-generator', | ||
'@semantic-release/github', | ||
], | ||
} |