Skip to content

Commit

Permalink
Automatically deploy builds to GitHub Pages
Browse files Browse the repository at this point in the history
This commit adds three new CI workflows:

  * 'Validation' builds BSC on pushes and PRs to master.
  * 'Release' builds BSC whenever a `v` tag is pushed and deploys it to
    GitHub Pages. It also creates a GitHub release.
  * 'Nightly' builds BSC Nightly every night and deploys it to GH Pages.

(Releases can't be used as the primary deployment medium, because assets
are served with `Content-Disposition: attachment`, so new users would be
prompted to save the userscript instead of install it.)

This is the plan for automatic user migration:

  1. We'll also deploy v3.15.0 at the old location.
  2. Users should automatically get v3.15.0 as usual.
  3. Users should now have the new @updateURL and @downloadurl.
  4. The next update check should refer to the new location.
  • Loading branch information
SimonAlling committed Jun 23, 2020
1 parent 094f045 commit 5863a22
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 27 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Nightly

on:
schedule:
- cron: '0 2 * * *'

jobs:
nightly:
name: Nightly Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Build
run: |
npm ci
npm run build
env:
CI: true
USERSCRIPTER_HOSTED_AT: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/nightly # Must match TARGET_FOLDER.
USERSCRIPTER_MODE: production
USERSCRIPTER_NIGHTLY: true
USERSCRIPTER_VERBOSE: true
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: dist
TARGET_FOLDER: nightly # Must match USERSCRIPTER_HOSTED_AT.
25 changes: 0 additions & 25 deletions .github/workflows/nodejs.yml

This file was deleted.

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

on:
push:
tags:
- v*

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Build
run: |
npm ci
npm run build
env:
CI: true
USERSCRIPTER_MODE: production
USERSCRIPTER_VERBOSE: true
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: dist
- name: Create GitHub release
uses: marvinpinto/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
files: |
dist/*.user.js
28 changes: 28 additions & 0 deletions .github/workflows/validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Validation

on: [push, pull_request]

jobs:
validation:
name: Validation Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Build (development)
run: |
npm ci
npm run build
env:
CI: true
USERSCRIPTER_VERBOSE: true
- name: Build (production)
run: |
npm run build
env:
CI: true
USERSCRIPTER_MODE: production
USERSCRIPTER_VERBOSE: true
4 changes: 2 additions & 2 deletions src/userscript.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export default {
id: "better-sweclockers",
name: "Better SweClockers",
version: "3.14.1",
version: "3.15.0",
description: "Extra functionality and improved usability for the SweClockers website.",
author: "Simon Alling",
hostname: "sweclockers.com",
sitename: "SweClockers",
namespace: "simonalling.se",
runAt: "document-start",
noframes: true, // because SweClockers has frames with `src=""`
hostedAt: "https://simonalling.github.io/userscripts/",
hostedAt: "https://simonalling.github.io/better-sweclockers/",
} as const;

0 comments on commit 5863a22

Please sign in to comment.