Force deploy #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
name: Force deploy | |
on: | |
workflow_dispatch: | |
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 | |
deploy: | |
name: Deploy (English Wikipedia) | |
needs: build | |
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/deploy-action@v1.1.0 | |
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)' |