Skip to content

Commit

Permalink
Merge pull request #40 from jolelievre/use-latest-tag
Browse files Browse the repository at this point in the history
Use latest TranslationTool in production
  • Loading branch information
jolelievre authored Sep 18, 2023
2 parents 04cbd76 + a3aff3d commit b7ccc8b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/push_archives_to_bucket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,32 @@ jobs:
environment:
name: ${{ inputs.environment }}
steps:
# For preproduction we use master and for production we use TranslationTool 1.0.2
# Initial checkout of the full repository to get the latest tag and change branch depending on the environment
- name: Checkout TranslationTools app
uses: actions/checkout@v3
with:
repository: PrestaShopCorp/TranslationTool
fetch-depth: 0
token: ${{ secrets.translation_tool_token }}

# For preproduction we use master and for production we use TranslationTool latest tag
# For other values we use the dev branch from TranslationTool
# The target branch for TranslationFiles is also defined based on the chosen environment
- name: Prepare Job settings
run: |
if test ${{ inputs.environment }} = "production";
then
echo "TRANSLATION_TOOL_REF=2.0.2" >> $GITHUB_OUTPUT
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $LATEST_TAG
echo "TRANSLATION_TOOL_REF=$LATEST_TAG" >> $GITHUB_OUTPUT
echo "TRANSLATION_FILES_BRANCH=master" >> $GITHUB_OUTPUT
elif test ${{ inputs.environment }} = "preproduction";
then
git checkout master
echo "TRANSLATION_TOOL_REF=master" >> $GITHUB_OUTPUT
echo "TRANSLATION_FILES_BRANCH=preproduction" >> $GITHUB_OUTPUT
else
git checkout dev
echo "TRANSLATION_TOOL_REF=dev" >> $GITHUB_OUTPUT
echo "TRANSLATION_FILES_BRANCH=integration" >> $GITHUB_OUTPUT
fi
Expand All @@ -51,14 +63,6 @@ jobs:
- name: Display task details
run: echo "Update PrestaShop version ${{ inputs.prestashop_version }} using environment ${{ inputs.environment }} with TranslationTool branch/tag ${{ steps.job-settings.outputs.TRANSLATION_TOOL_REF }} and content from TranslationFiles branch ${{ steps.job-settings.outputs.TRANSLATION_FILES_BRANCH }}"

# Checkout TranslationTool repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout TranslationTools app
uses: actions/checkout@v3
with:
repository: PrestaShopCorp/TranslationTool
ref: ${{ steps.job-settings.outputs.TRANSLATION_TOOL_REF }}
token: ${{ secrets.translation_tool_token }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,17 @@ For 8 and higher versions, endpoints follow this structure: https://i18n.prestas
## License

All translations are licensed under the OSL-3.0 license

## Automatic updates and workflows

This repository is the base of the PrestaShop translation API, you will find more details about the workflow on this project https://github.com/PrestaShopCorp/TranslationTool (not public for now).
But a quick resume is that an automatic action is rune on this repository on each push so that the modifications are pushed on the Google bucket that stores the translation files.

This operation is defined in [this workflow file](.github/workflows/automatic_push_archives_to_bucket.yml).

For this Github action to work you will need to define two secrets:

| Secret name | Description |
|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CREDENTIALS_JSON | A [Service Account key file](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount) to be able to push on the GCP bucket. This variable is set in environment variables as it is not the same for all environements. |
| TRANSLATION_TOOL_TOKEN | A GitHub personal access token that allows cloning the PrestaShopCorp/TranslationTool repository |

0 comments on commit b7ccc8b

Please sign in to comment.