include flatpak .desktop only im yaml fix 01 #20
This file contains hidden or 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: Translate and Build Package | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| debug_enabled: | |
| type: boolean | |
| description: 'With TMATE' | |
| required: false | |
| default: false | |
| push: | |
| branches: [ "*" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: If Template exit | |
| shell: bash | |
| run: | | |
| cancel () { | |
| echo "Pacote de template, não precisa traduzir e compilar" | |
| echo "SAINDO...." | |
| curl -s -H "Authorization: token ${{ github.token }}" \ | |
| -X POST "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel" | |
| sleep infinity | |
| } | |
| if [ -n "$(grep biglinux-package-template pkgbuild/PKGBUILD)" ];then | |
| cancel | |
| fi | |
| - name: Install Translator Dependencies | |
| shell: bash | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install \ | |
| git \ | |
| gettext \ | |
| npm | |
| # Install attranslator | |
| sudo npm install --location=global attranslate | |
| ## Tmate ## | |
| - name: Setup TMATE Session | |
| uses: mxschmitt/action-tmate@v3 | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
| - name: Generate Translatable Strings File | |
| shell: bash | |
| run: | | |
| # Caminho para o código-fonte da aplicação | |
| APP_SOURCE_DIR="usr/share/biglinux/welcome" | |
| # Executa o script gerador | |
| python3 generate_strings.py \ | |
| "${APP_SOURCE_DIR}/pages.yaml" \ | |
| "${APP_SOURCE_DIR}/translatable_strings.py" | |
| - name: Translate Package | |
| shell: bash #-O extglob {0} | |
| env: | |
| AZURE_KEY: ${{ secrets.AZURE_KEY }} | |
| OPENAI_KEY: ${{ secrets.OPENAI_KEY }} | |
| run: | | |
| cd .. | |
| git clone https://github.com/biglinux/big-auto-translator.git | |
| mv big-auto-translator/gettext_po_generator_github.sh . | |
| sudo cp -f big-auto-translator/openai-translate.js /usr/local/lib/node_modules/attranslate/dist/services/openai-translate.js | |
| gitfolder=$(echo ${{ github.repository }} | rev | cut -d "/" -f1 | rev) | |
| # export OriginalLang=en-US | |
| bash gettext_po_generator_github.sh $gitfolder | |
| - name: Update github | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add --all | |
| if [ -n "$(git commit -m "translate $(date +%y-%m-%d_%H:%M)" -a | grep "nothing to commit")" ];then exit 0; fi | |
| - name: Push changes | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref }} | |