Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: GitHub Release

on:
push:
tags: ['v*']

permissions:
contents: read

concurrency:
group: release-${{ github.ref }}

jobs:
package:
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22.x
cache: npm
- name: Check tag and package version
run: |
version=$(node -p 'require("./package.json").version')
if [[ "$GITHUB_REF_NAME" != "v$version" ]]; then
echo "Tag $GITHUB_REF_NAME must match package version v$version" >&2
exit 1
fi
- run: npm ci
- run: npm test
- run: npm pack
- name: Test the packaged CLI
run: |
prefix=$(mktemp -d)
npm install --global --prefix "$prefix" "./javascripting-${GITHUB_REF_NAME#v}.tgz"
cd "$prefix"
HOME="$prefix" LANG=en ./bin/javascripting --help
HOME="$prefix" LANG=en ./bin/javascripting select 0
HOME="$prefix" LANG=en ./bin/javascripting current | grep -F INTRODUCTION
- uses: actions/upload-artifact@v4
with:
name: npm-package
path: javascripting-*.tgz
if-no-files-found: error

publish:
needs: package
runs-on: ubuntu-slim
permissions:
contents: write
steps:
- uses: actions/setup-node@v7
with:
node-version: 22.x
- uses: actions/download-artifact@v4
with:
name: npm-package
- name: Publish and verify the release
env:
GH_TOKEN: ${{ github.token }}
run: |
package="javascripting-${GITHUB_REF_NAME#v}.tgz"
url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/$GITHUB_REF_NAME/$package"
cat > "$RUNNER_TEMP/release-notes.md" <<NOTES
Requires Node.js 22.12.0 or later.

\`\`\`sh
npm install -g $url
javascripting
\`\`\`
NOTES
if ! gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null; then
gh release create "$GITHUB_REF_NAME" "$package" --repo "$GITHUB_REPOSITORY" \
--verify-tag --generate-notes --notes-file "$RUNNER_TEMP/release-notes.md"
fi
prefix=$(mktemp -d)
npm install --global --prefix "$prefix" "$url"
cd "$prefix"
HOME="$prefix" LANG=en ./bin/javascripting --help
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ Also, take a look into our [troubleshooting documentation](https://github.com/wo

Install a [Node.js LTS release](https://nodejs.org/en/download). The minimum supported version is Node.js 22.12.0. We use the oldest [LTS release line still supported by Node.js](https://github.com/nodejs/Release#release-schedule) as the minimum.

### Install `javascripting` with `npm`
### Install from GitHub Releases

Open your terminal and run this command:
Use the version-specific install command in the [GitHub release notes](https://github.com/workshopper/javascripting/releases). For version 3.0.0, run

```sh
npm install -g https://github.com/workshopper/javascripting/releases/download/v3.0.0/javascripting-3.0.0.tgz
```
npm install -g javascripting
```

The `-g` option installs this module globally so that you can run it as a command in your terminal.

## Run the workshop

Expand Down
16 changes: 3 additions & 13 deletions TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,11 @@

### `EACCES` during installation

If `npm install -g javascripting` fails with `EACCES`, your account may lack write access to npm’s global installation directory. You can start the workshop directly:
If the GitHub Release install command fails with `EACCES`, your account may lack write access to npm’s global installation directory.

```sh
npx javascripting
```
npm recommends installing Node.js and npm with a Node version manager. On macOS and Linux, you can also configure npm to install global packages in your home directory. Follow [npm’s guide to resolving global installation permissions](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally/).

When an exercise asks you to run a workshop command, prefix it with `npx`, for example `npx javascripting verify introduction.js`.

If you prefer a global installation, npm recommends installing Node.js and npm with a Node version manager. On macOS and Linux, you can also configure npm to install global packages in your home directory. Follow [npm’s guide to resolving global installation permissions](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally/).

After completing the setup, retry the installation from your regular terminal:

```sh
npm install -g javascripting
```
After completing the setup, retry the [GitHub Release install command](README.md#install-from-github-releases) from your regular terminal.

### `EEXIST` error

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "javascripting",
"description": "Learn JavaScript by adventuring around in the terminal.",
"version": "2.7.4",
"version": "3.0.0",
"author": "sethvincent",
"bin": {
"javascripting": "./bin/javascripting"
Expand Down