Skip to content

build(deps-dev): bump the typescript group across 1 directory with 2 updates #841

build(deps-dev): bump the typescript group across 1 directory with 2 updates

build(deps-dev): bump the typescript group across 1 directory with 2 updates #841

Workflow file for this run

name: CI/CD
on:
push:
tags:
- 'v*'
branches-ignore:
- dependabot/**
- actions/**
paths:
- src/**
- tests/**
- i18n/**
- data/types
- .github/workflows/ci-cd.yml
- package.json
- package-lock.json
pull_request:
jobs:
build:
name: Build Deputy
if: ${{ !contains(github.event.head_commit.message, '[failing]') }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ^20.11
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
NODE_ENV: production
- name: Upload transpiled code
uses: actions/upload-artifact@v4
with:
name: builds
path: build/*.js
- name: Upload sourcemaps
uses: actions/upload-artifact@v4
with:
name: sourcemaps
path: build/*.js.map
tests:
name: Perform tests
needs: build
strategy:
fail-fast: false
matrix:
os: [ windows-latest, ubuntu-latest ]
browser:
# Chrome stable
- product: chrome
version: stable
# Chrome Canary
- product: chrome
version: canary
# Firefox stable
- product: firefox
version: latest
# Firefox beta
- product: firefox
version: latest-beta
# Firefox ESR
- product: firefox
version: latest-esr
runs-on: ${{ matrix.os }}
if: ${{ !contains(github.event.head_commit.message, '[failing]') }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}--${{ matrix.os }}-${{ matrix.browser.product }}-${{ matrix.browser.version }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Firefox
if: matrix.browser.product == 'firefox'
uses: browser-actions/setup-firefox@latest
with:
firefox-version: ${{ matrix.browser.version }}
- name: Install geckodriver
if: matrix.browser.product == 'firefox'
uses: browser-actions/setup-geckodriver@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install chromedriver
if: matrix.browser.product == 'chrome'
uses: nanasess/setup-chromedriver@v2
- name: Setup Node
if: matrix.browser.product != 'firefox' || matrix.os != 'windows-latest'
uses: actions/setup-node@v4
with:
node-version: ^20.11
cache: 'npm'
- name: Install dependencies
run: npm ci
env:
NODE_ENV: development
- name: Download transpiled code
uses: actions/download-artifact@v4
with:
name: builds
path: build/
- name: Download sourcemaps
uses: actions/download-artifact@v4
with:
name: sourcemaps
path: build/
- name: Run tests
run: npm run test:jest
env:
BROWSER: ${{ matrix.browser.product }}
- name: Upload test artifacts
uses: actions/upload-artifact@v4
with:
name: test-artifacts--${{ matrix.os }}-${{ matrix.browser.product }}-${{ matrix.browser.version }}
path: tests/artifacts/*
release:
name: Draft release
needs: tests
runs-on: ubuntu-latest
if: ${{ startsWith( github.ref, 'refs/tags/v' ) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: repo/
- name: Download transpiled code
uses: actions/download-artifact@v4
with:
name: builds
path: artifacts/
- name: Download sourcemaps
uses: actions/download-artifact@v4
with:
name: sourcemaps
path: artifacts/
- name: Extract CHANGELOG section
run: |
cat repo/CHANGELOG.md | node -p "require('fs').readFileSync(0).toString('utf-8').match(/# [\s\S]+?(?=\s#\s)/g)[1].trim().split('\n').slice(1).join('\n')" > CHANGELOG_EXTRACT.md
- name: Read CHANGELOG extract
id: changelog
uses: juliangruber/read-file-action@v1
with:
path: ./CHANGELOG_EXTRACT.md
- name: Check if CHANGELOG is formed
if: ${{ !contains( steps.changelog.outputs.content, 'deputy/compare/' ) }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('CHANGELOG.md does not have a comparison link. Are there still parts in Unreleased?')
- name: Draft release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ github.ref_name }}
prerelease: ${{ contains( github.ref_name, '-rc' ) }}
makeLatest: ${{ !contains( github.ref_name, '-rc' ) }}
draft: true
body: ${{ steps.changelog.outputs.content }}
artifacts: "artifacts/*"
allowUpdates: true
replacesArtifacts: true
deploy:
name: Deploy (English Wikipedia)
needs: tests
runs-on: ubuntu-latest
environment: en.wikipedia
# `main` branch or version release only
if: ${{ (
startsWith( github.ref, 'refs/tags/v' ) || github.ref == 'refs/heads/main'
) && github.event.head_commit.author.name != 'dependabot[bot]' }}
concurrency:
group: deploy-en.wikipedia
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download transpiled code
uses: actions/download-artifact@v4
with:
name: builds
- name: Wipe sourcemap references
run: sed -i 's/\/\/# sourceMappingURL=.*//' deputy*.js
- name: Get edit summary
id: edit-summary
run: |
if [ $GITHUB_REF == refs/tags/v* ]; then
echo "message=$(git show -s --format="[%h] %s" $GITHUB_REF)" >> $GITHUB_OUTPUT
else
TAG=$(echo $GITHUB_REF | sed -E 's/^refs\/tags\/(.*)\/.*/\1/')
echo "message=$TAG; https://github.com/ChlodAlejandro/deputy/releases/tag/$TAG " >> $GITHUB_OUTPUT
fi
- name: Deploy to Wikipedia
uses: wikimedia-gadgets/[email protected]
with:
paths: |
deputy.js User:Chlod/Scripts/Deputy.js
deputy-ante.js User:Chlod/Scripts/Deputy/AttributionNoticeTemplateEditor.js
deputy-ia.js User:Chlod/Scripts/Deputy/InfringementAssistant.js
apiUrl: 'https://en.wikipedia.org/w/api.php'
oauth2Token: ${{ secrets.OAUTH_ACCESS_TOKEN }}
editSummary: '${{ steps.edit-summary.output.message }} (bot/CD)'