Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
397080c
Adding the crowdin sync workflow
joseph-flinn Aug 13, 2021
4533e04
using the updated github action from web
joseph-flinn Aug 13, 2021
cfba106
adding some debugging
joseph-flinn Aug 13, 2021
7495476
Autosync Crowdin translations
Aug 13, 2021
617074e
adding logic to handle if there are no changes
joseph-flinn Aug 13, 2021
c2af9c2
Merge branch 'master' into add-crowdin-sync-workflow
joseph-flinn Aug 13, 2021
ec2023f
Merge pull request #2008 from bitwarden/add-crowdin-sync-workflow
joseph-flinn Aug 13, 2021
e2f0fea
Version bump to 1.52.0 (#2018)
MGibson1 Aug 17, 2021
061708c
changed ngIf to hidden for send options
addisonbeck Aug 18, 2021
6255482
Merge pull request #2019 from bitwarden/SendOptionsBug
Aug 18, 2021
e2c5b8e
Autosync Crowdin translations
Aug 18, 2021
05ba96d
Merge pull request #2010 from bitwarden/crowdin-auto-sync
joseph-flinn Aug 18, 2021
b850117
Revert "Remove unsafe-inline from Content Security Policy in manifest…
eliykat Aug 19, 2021
689303b
Reverting the Crowdin English changes
joseph-flinn Aug 19, 2021
9641c70
Merge pull request #2025 from bitwarden/revert-en-crowdin-sync
joseph-flinn Aug 19, 2021
2ebd860
Fixed order of supportedLocales to have 'en' as fallback again
djsmith85 Aug 19, 2021
4d1c44f
Merge pull request #2026 from bitwarden/set_en_as_fallback_language
djsmith85 Aug 19, 2021
294e7c3
Bump version to 1.52.1 (#2027)
Hinton Aug 20, 2021
ad07b11
Updating the release name
joseph-flinn Aug 20, 2021
8b61d05
Reverting changes to Portuguese and Chinese
joseph-flinn Aug 24, 2021
3a8ae46
Merge pull request #2028 from bitwarden/fix-release-name
joseph-flinn Aug 24, 2021
b13fae4
Merge pull request #2037 from bitwarden/hotfix/revert-bad-translations
joseph-flinn Aug 25, 2021
a1f7e07
Add password show/hide to reprompt (#1902)
Hinton Aug 27, 2021
1c7504a
[Callout] Update UI structure (#2020)
vincentsalucci Aug 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 169 additions & 0 deletions .github/workflows/crowdin-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,172 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Setup git config
run: |
git config user.name "github-actions"
git config user.email "<>"

- name: Get Crowndin Sync Branch
id: branch
run: |
BRANCH_NAME=crowdin-auto-sync
BRANCH_EXISTS=true

git fetch -a
git switch master
if [ $(git branch -a | egrep "remotes/origin/${BRANCH_NAME}$" | wc -l) -eq 0 ]; then
BRANCH_EXISTS=false
git switch -c $BRANCH_NAME
else
git switch $BRANCH_NAME
fi
git branch

echo "::set-output name=branch-exists::$BRANCH_EXISTS"
echo "::set-output name=branch-name::$BRANCH_NAME"

- name: Login to Azure
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
with:
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}

- name: Retrieve secrets
id: retrieve-secrets
uses: Azure/get-keyvault-secrets@80ccd3fafe5662407cc2e55f202ee34bfff8c403
with:
keyvault: "bitwarden-prod-kv"
secrets: "crowdin-api-token"

- name: Get Crowdin master branch id
id: crowdin-master-branch
env:
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
run: |
# Step 1: GET master branchId
BRANCH_ID=$(
curl -s -H "Authorization: Bearer $CROWDIN_API_TOKEN" \
$CROWDIN_BASE_URL/$CROWDIN_PROJECT_ID/branches | jq -r '.data[0].data.id'
)
echo "[*] Crowin master branch id: $BRANCH_ID"
echo "::set-output name=id::$BRANCH_ID"

- name: Get Crowdin build id
id: crowdin-build
env:
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
CROWDIN_MASTER_BRANCH_ID: ${{ steps.crowdin-master-branch.outputs.id }}
run: |
# Step 2: POST Build the translations and get store build id
BUILD_ID=$(
curl -X POST -s \
-H "Authorization: Bearer $CROWDIN_API_TOKEN" \
-H "Content-Type: application/json" \
$CROWDIN_BASE_URL/$CROWDIN_PROJECT_ID/translations/builds \
-d "{\"branchId\": $CROWDIN_MASTER_BRANCH_ID}" | jq -r '.data.id'
)
echo "[*] Crowin translations build id: $BRANCH_ID"
echo "::set-output name=id::$BUILD_ID"

- name: Wait for Crowdin build to finish
env:
MAX_TRIES: 12
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
CROWDIN_BUILD_ID: ${{ steps.crowdin-build.outputs.id }}
run: |
for try in {1..$MAX_TRIES}; do
BRANCH_STATUS=$(
curl -s -H "Authorization: Bearer $CROWDIN_API_TOKEN" \
$CROWDIN_BASE_URL/$CROWDIN_PROJECT_ID/translations/builds/$CROWDIN_BUILD_ID | jq -r '.data.status'
)
echo "[*] Build status: $BRANCH_STATUS"
if [[ "$BRANCH_STATUS" == "finished" ]]; then break; fi
if [[ "$try" == "$MAX_TRIES" ]]; then
echo "[!] Exceeded tries: $try"
exit 1
else
sleep 5
fi
done

- name: Get Crowdin download URL
id: crowdin-download-url
env:
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
CROWDIN_BUILD_ID: ${{ steps.crowdin-build.outputs.id }}
run: |
# Step 4: when build is finished, get download url
DOWNLOAD_URL=$(
curl -s -H "Authorization: Bearer $CROWDIN_API_TOKEN" \
$CROWDIN_BASE_URL/$CROWDIN_PROJECT_ID/translations/builds/$CROWDIN_BUILD_ID/download | jq -r '.data.url'
)
echo "[*] Crowin translations download url: $DOWNLOAD_URL"
echo "::set-output name=value::$DOWNLOAD_URL"

- name: Download Crowdin translations
env:
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
CROWDIN_DOWNLOAD_URL: ${{ steps.crowdin-download-url.outputs.value }}
SAVE_FILE: "translations.zip"
run: |
# Step 5: download the translations via the download url
curl -s $CROWDIN_DOWNLOAD_URL --output $SAVE_FILE
echo "[*] Saved to: $SAVE_FILE"
unzip -o $SAVE_FILE
rm $SAVE_FILE

- name: Check changes
id: files-changed
env:
BRANCH_NAME: ${{ steps.branch.outputs.branch-name }}
BRANCH_EXISTS: ${{ steps.branch.outputs.branch-exists }}
run: |
DIFF_BRANCH=master
if [[ "$BRANCH_EXISTS" == "true" ]]; then
DIFF_BRANCH=$BRANCH_NAME
fi

DIFF_LEN=$(git diff origin/${DIFF_BRANCH} | wc -l | xargs)
echo "[*] git diff lines: ${DIFF_LEN}"
echo "::set-output name=num::$DIFF_LEN"

- name: Commit changes
env:
BRANCH_NAME: ${{ steps.branch.outputs.branch-name }}
BRANCH_EXISTS: ${{ steps.branch.outputs.branch-exists }}
DIFF_BRANCH: master
DIFF_LEN: ${{ steps.files-changed.outputs.num }}
run: |
echo "=====Translations Changed====="
git diff --name-only origin/${DIFF_BRANCH}
echo "=============================="

if [ "$DIFF_LEN" != "0" ]; then
echo "[*] Adding new translations"
git add .
echo "[*] Committing"
git commit -m "Autosync Crowdin translations"
echo "[*] Pushing"
if [ "$BRANCH_EXISTS" == "false" ]; then
git push -u origin $BRANCH_NAME
else
git push
fi
else
echo "[*] No new docs"
fi

- name: Create/Update PR
if: ${{ steps.files-changed.outputs.num }} != 0
env:
BRANCH_NAME: ${{ steps.branch.outputs.branch-name }}
BRANCH_EXISTS: ${{ steps.branch.outputs.branch-exists }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "$BRANCH_EXISTS" == "false" ]; then
echo "[*] Creating PR"
gh pr create --title "Autosync Crowdin Translations" \
--body "Autosync the updated translations"
else
echo "[*] Existing PR updated"
fi
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_TAG_NAME }}
release_name: ${{ env.RELEASE_NAME }}
release_name: Version ${{ env.RELEASE_NAME }}
draft: true
prerelease: false

Expand Down
Loading