Workflow file for this run
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: Deploy production build and configs | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: npm ci | |
- run: npm run build16 | |
- run: npm test | |
- name: Create a SSH tunnel and deploy | |
env: | |
SSH_USER: ${{ secrets.TOOLFORGE_USER }} | |
SSH_KEY: ${{ secrets.TOOLFORGE_KEY }} | |
USERNAME: ${{ secrets.WIKI_USERNAME }} | |
PASSWORD: ${{ secrets.WIKI_PASSWORD }} | |
run: | | |
mkdir -p ~/.ssh | |
echo -e "$SSH_KEY" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
# Create a SSH tunnel in the background. | |
ssh -o StrictHostKeyChecking=no -N -D 1081 ${{ secrets.TOOLFORGE_USER }}@tools-login.wmflabs.org & | |
SSH_JOB="$!" | |
# This trap will get overrided below, but also set it here just in case HPTS fails to | |
# start. | |
trap "kill $SSH_JOB" EXIT | |
# Run the converter of a HTTP proxy to SOCKS. | |
./node_modules/.bin/hpts -s 127.0.0.1:1081 -p 8080 & | |
HPTS_JOB="$!" | |
# Kill both background jobs on exit. | |
trap "kill $SSH_JOB; kill $HPTS_JOB" EXIT | |
sleep 3 | |
rm ~/.ssh/id_rsa | |
# Run own script to login and publish the build results to pages. | |
npm run deploy --noi18n | |
- name: Create source maps folder | |
run: cd dist && mkdir source-maps && cp *.map.json source-maps | |
- name: Deploy source maps | |
uses: easingthemes/[email protected] | |
env: | |
REMOTE_HOST: "tools-login.wmflabs.org" | |
REMOTE_USER: ${{ secrets.TOOLFORGE_USER }} | |
SSH_PRIVATE_KEY: ${{ secrets.TOOLFORGE_KEY }} | |
ARGS: "-rltgoDzvO" | |
SOURCE: "dist/source-maps/" | |
TARGET: "/data/project/convenient-discussions/www/static/source-maps" | |
- name: Take file ownership to the tool | |
uses: appleboy/[email protected] | |
with: | |
host: "tools-login.wmflabs.org" | |
username: ${{ secrets.TOOLFORGE_USER }} | |
key: ${{ secrets.TOOLFORGE_KEY }} | |
script: become convenient-discussions bash -c 'cd www/static && take source-maps && chmod -R g+w source-maps' |