mirror of
https://github.com/scratchfoundation/scratch-l10n.git
synced 2024-12-22 21:52:35 -05:00
b9f2d4c8fd
Swap out circleci key
137 lines
4 KiB
YAML
137 lines
4 KiB
YAML
version: 2.1
|
|
orbs:
|
|
node: circleci/node@2.1.0
|
|
slack: circleci/slack@3.4.2
|
|
defaults: &defaults
|
|
working_directory: ~/project
|
|
executor:
|
|
name: node/default
|
|
tag: '16.18.0'
|
|
jobs:
|
|
build-and-test:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- node/install-packages #node orb cmd caches
|
|
- run: npm run test
|
|
- persist_to_workspace:
|
|
root: ~/project
|
|
paths: .
|
|
deploy-npm:
|
|
<<: *defaults
|
|
steps:
|
|
- attach_workspace:
|
|
at: ~/project
|
|
- add_ssh_keys:
|
|
fingerprints:
|
|
- "be:38:fa:65:8c:8b:cc:04:db:f5:2b:6e:22:9d:82:55"
|
|
- run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts
|
|
- run:
|
|
name: "configure release version"
|
|
command: |
|
|
VPKG=$($(npm bin)/json -f package.json version)
|
|
echo "export VERSION=${VPKG/%?/}$(date +%Y%m%d%H%M%S)" >> $BASH_ENV
|
|
- run:
|
|
name: "publish"
|
|
command: |
|
|
npm --no-git-tag-version version $VERSION
|
|
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
|
|
npm publish
|
|
- run:
|
|
name: "tag release"
|
|
command: |
|
|
git tag $VERSION
|
|
git push $CIRCLE_REPOSITORY_URL $VERSION
|
|
pull-translations:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- node/install-packages
|
|
- run:
|
|
name: "pull editor and www translations"
|
|
command: |
|
|
npm run pull:editor
|
|
npm run pull:www
|
|
npm run test
|
|
no_output_timeout: 30m
|
|
- persist_to_workspace:
|
|
root: ~/project
|
|
paths: .
|
|
- slack/status:
|
|
fail_only: true
|
|
failure_message: ":explosion: Pull editor and www translations failed, for help see: https://github.com/LLK/scratch-l10n/wiki/Developer-Guide#weekly-editor-and-website-update"
|
|
only_for_branches: "master"
|
|
commit-translations:
|
|
<<: *defaults
|
|
steps:
|
|
- attach_workspace:
|
|
at: ~/project
|
|
- add_ssh_keys:
|
|
fingerprints:
|
|
- "be:38:fa:65:8c:8b:cc:04:db:f5:2b:6e:22:9d:82:55"
|
|
- run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts
|
|
- run:
|
|
name: "commit translation updates"
|
|
command: |
|
|
git config --global user.email $(git log --pretty=format:"%ae" -n1)
|
|
git config --global user.name $(git log --pretty=format:"%an" -n1)
|
|
git add .
|
|
if git diff --cached --exit-code --quiet; then
|
|
echo "Nothing to commit."
|
|
else
|
|
git commit -m "pull new editor translations from Transifex"
|
|
git push $CIRCLE_REPOSITORY_URL HEAD:master
|
|
fi
|
|
sync-help:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- node/install-packages
|
|
- run: npm run sync:help
|
|
- slack/status:
|
|
fail_only: true
|
|
failure_message: ":boom: Scratch Help update failed, for help see: https://github.com/LLK/scratch-l10n/wiki/Developer-Guide#daily-help-update"
|
|
only_for_branches: "master"
|
|
workflows:
|
|
version: 2
|
|
build-test-and-deploy:
|
|
jobs:
|
|
- build-and-test
|
|
- deploy-npm:
|
|
requires:
|
|
- build-and-test
|
|
filters:
|
|
branches:
|
|
only: master
|
|
manual-pull:
|
|
when:
|
|
equal: [ tx-pull-manual, << pipeline.git.branch >> ]
|
|
jobs:
|
|
- pull-translations
|
|
- commit-translations:
|
|
requires:
|
|
- pull-translations
|
|
filters:
|
|
branches:
|
|
only: tx-pull-manual
|
|
daily-tx-pull:
|
|
triggers:
|
|
- schedule: # daily at 3am UTC (10pm EST)
|
|
cron: "0 3 * * *"
|
|
filters:
|
|
branches:
|
|
only: master
|
|
jobs:
|
|
- pull-translations
|
|
- commit-translations:
|
|
requires:
|
|
- pull-translations # don't commit if there were errors
|
|
daily-help-update:
|
|
triggers:
|
|
- schedule: # daily at 5am UTC
|
|
cron: "0 5 * * *"
|
|
filters:
|
|
branches:
|
|
only: master
|
|
jobs:
|
|
- sync-help
|