Skip to content
Open
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
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this to Linter? The idea being that in the future, we might add a different CI job that is for unit tests.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see, this is the standard check file name used on GitHub. Are you sure you want to change it?


on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

- name: Build project
run: npm run build
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to build the project to run a linter? Linters just statically analyze code files. Consider removing all this build stuff.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Continuous Integration, we fully check the project build and its errors both during the build and during the linter.


- name: Check build artifacts
run: |
ls -la dist/
test -f dist/rater.js
test -f dist/rater.min.js
59 changes: 59 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually deploy? Seems like all it does is increment the version number. Long term, I'd like to stop using version numbers, in order to simplify the deploy process. Simple deploys = better DX (developer experience). Eventually I want to get it added to https://gadget-deploy.toolforge.org/ so we have one click deploys.

Anyway, if all this github action does is increment the version, I'd suggest removing it.

Copy link
Copy Markdown
Author

@In1quity In1quity Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file does one more check just in case and creates built (minified+bundle) files when adding a version tag. This is useful because any user can download the file they need without having to go to production.

Copy link
Copy Markdown
Author

@In1quity In1quity Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You create a tag "vNUMBER", the action sees it and deploys the files.
git tag -a v0.1.2 -m "Release notes..."


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

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

- name: Build project
run: npm run build

- name: Get tag message
if: startsWith(github.ref, 'refs/tags/')
id: tag_message
run: |
TAG_MESSAGE=$(git tag -l --format='%(contents)' ${{ github.ref_name }})
echo "tag_message<<EOF" >> $GITHUB_OUTPUT
echo "$TAG_MESSAGE" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
body: |
${{ steps.tag_message.outputs.tag_message }}

## Build Artifacts
- `dist/rater.js` - Development build (unminified)
- `dist/rater.min.js` - Production build (minified)

## Installation
Install the userscript by copying the contents of `dist/rater.min.js` into your userscript manager.
files: |
dist/rater.js
dist/rater.min.js