chore: Revert upgrade of replace-in-file due to unpredictable results… #580
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: Test, Build & Deploy | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
test_build_deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 1 | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.11.0 | |
with: | |
access_token: ${{github.token}} | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set BRANCH_NAME, TAG & COMMIT_MESSAGE environment variables | |
run: | | |
echo "BRANCH_NAME=$(git branch --show-current)" >> $GITHUB_ENV | |
echo "TAG=$(git tag --points-at ${{github.sha}})" >> $GITHUB_ENV | |
echo "COMMIT_MESSAGE=$(git log --format=%B -n 1 ${{github.event.after}} | head -n 1)" >> $GITHUB_ENV | |
- name: Print environment variables | |
env: | |
GITHUB_CONTEXT: ${{toJson(github)}} | |
run: | | |
echo -e "BRANCH_NAME = ${BRANCH_NAME}" | |
echo -e "TAG = ${TAG}" | |
echo -e "COMMIT_MESSAGE = ${COMMIT_MESSAGE}" | |
echo -e "GITHUB_SHA = ${GITHUB_SHA}" | |
echo -e "GITHUB_REF = ${GITHUB_REF}" | |
echo -e "GITHUB_CONTEXT = ${GITHUB_CONTEXT}" | |
- name: Yarn cache | |
uses: c-hive/gha-yarn-cache@v1 | |
- name: Install JS dependencies | |
run: | | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
nvm install 16 | |
nvm use 16 | |
yarn | |
- name: Test | |
run: yarn test | |
- name: Upload translations | |
if: github.event_name == 'pull_request' && (github.actor != 'dependabot[bot]' && github.actor != 'otto-the-bot') | |
uses: crowdin/github-action@v1.12.0 | |
env: | |
CROWDIN_PROJECT_ID: 202775 | |
CROWDIN_CONFIG_PATH: 'crowdin.yml' | |
GITHUB_TOKEN: ${{github.OTTO_THE_BOT_GH_TOKEN}} | |
GITHUB_ACTOR: otto-the-bot | |
INPUT_DEBUG_MODE: true | |
with: | |
upload_sources: true | |
upload_translations: false | |
download_translations: true | |
skip_untranslated_files: true | |
push_translations: false | |
create_pull_request: false | |
token: ${{secrets.WEB_CROWDIN_TOKEN}} | |
config: ${{env.CROWDIN_CONFIG_PATH}} | |
- name: Download translations | |
if: env.BRANCH_NAME == 'master' | |
uses: crowdin/github-action@v1.12.0 | |
env: | |
GITHUB_TOKEN: ${{github.OTTO_THE_BOT_GH_TOKEN}} | |
GITHUB_ACTOR: otto-the-bot | |
CROWDIN_PROJECT_ID: ${{env.CROWDIN_PROJECT_ID}} | |
INPUT_DEBUG_MODE: true | |
with: | |
upload_sources: false | |
upload_translations: false | |
download_translations: true | |
skip_untranslated_files: false | |
push_translations: false | |
create_pull_request: false | |
token: ${{secrets.WEB_CROWDIN_TOKEN}} | |
config: ${{env.CROWDIN_CONFIG_PATH}} | |
- name: Build | |
if: env.BRANCH_NAME == 'master' | |
# We need to execute `yarn translate:process` with sudo in order to delete and modify files | |
run: | | |
sudo yarn translate:process | |
sudo yarn build | |
- name: Commit | |
if: env.BRANCH_NAME == 'master' | |
run: | | |
git config --global user.email webapp+travis@wire.com | |
git config --global user.name "Wire Travis CI" | |
git add . | |
git status | |
git diff-index --quiet HEAD || git commit -am 'Otto build' | |
- name: Deploy | |
if: env.BRANCH_NAME == 'master' | |
run: yarn deploy |