11name : Translate and Build Package
22
3- # Controls when the workflow will run
43on :
54 workflow_dispatch :
6-
5+ inputs :
6+ debug_enabled :
7+ type : boolean
8+ description : ' With TMATE'
9+ required : false
10+ default : false
11+
712 push :
8- # branches: [ "master", "main", "*" ]
913 branches : [ "*" ]
10- # pull_request:
11- # branches: [ "master", "main", "*" ]
12- # branches: [ "*" ]
1314
14- # A workflow run is made up of one or more jobs that can run sequentially or in parallel
1515jobs :
16- # This workflow contains a single job called "build"
1716 build :
18- # The type of runner that the job will run on
1917 runs-on : ubuntu-latest
20-
21- # Steps represent a sequence of tasks that will be executed as part of the job
2218 steps :
23- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
24- - uses : actions/checkout@v3
19+ - uses : actions/checkout@v4
20+ - name : If Template exit
21+ shell : bash
22+ run : |
23+ cancel () {
24+ echo "Pacote de template, não precisa traduzir e compilar"
25+ echo "SAINDO...."
26+ curl -s -H "Authorization: token ${{ github.token }}" \
27+ -X POST "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
28+ sleep infinity
29+ }
30+ if [ -n "$(grep biglinux-package-template pkgbuild/PKGBUILD)" ];then
31+ cancel
32+ fi
2533
2634 - name : Install Translator Dependencies
2735 shell : bash
@@ -31,39 +39,45 @@ jobs:
3139 git \
3240 gettext \
3341 npm
34-
3542 # Install attranslator
3643 sudo npm install --location=global attranslate
37-
44+
45+ # # Tmate ##
46+ - name : Setup TMATE Session
47+ uses : mxschmitt/action-tmate@v3
48+ if : ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
49+
3850 - name : Translate Package
39- shell : bash -O extglob {0}
51+ shell : bash # -O extglob {0}
4052 env :
4153 AZURE_KEY : ${{ secrets.AZURE_KEY }}
54+ OPENAI_KEY : ${{ secrets.OPENAI_KEY }}
4255 run : |
4356 cd ..
4457 git clone https://github.com/biglinux/big-auto-translator.git
4558 mv big-auto-translator/gettext_po_generator_github.sh .
59+ sudo cp -f big-auto-translator/openai-translate.js /usr/local/lib/node_modules/attranslate/dist/services/openai-translate.js
4660 gitfolder=$(echo ${{ github.repository }} | rev | cut -d "/" -f1 | rev)
61+ export OriginalLang=pt-BR
4762 bash gettext_po_generator_github.sh $gitfolder
48-
49- # # Tmate ##
50- # - name: Setup tmate session
51- # uses: mxschmitt/action-tmate@v3
52-
63+
5364 - name : Update github
5465 run : |
55- git add --all
56- git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
66+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
5767 git config --local user.name "github-actions[bot]"
58- if [ -n "$(git commit -m "new translate" -a | grep "nothing to commit")" ];then exit 0; fi
59-
68+ git add --all
69+ if [ -n "$(git commit -m "translate $(date +%y-%m-%d_%H:%M)" -a | grep "nothing to commit")" ];then exit 0; fi
70+
6071 - name : Push changes
6172 uses : ad-m/github-push-action@master
6273 with :
6374 github_token : ${{ secrets.GITHUB_TOKEN }}
6475 branch : ${{ github.ref }}
65-
76+
6677 - name : Send Hooks BigLinux Build Package
6778 shell : bash
6879 run : |
69- curl -X POST -H "Accept: application/json" -H "Authorization: token ${{ secrets.WEBHOOK_TOKEN }}" --data '{"event_type": "${{ github.repository }}", "client_payload": { "branch": "${{ github.ref_name }}", "url": "https://github.com/${{ github.repository }}", "version": "1.2.3"}}' https://api.github.com/repos/BigLinux-Package-Build/build-package/dispatches
80+ if [ -z "$(grep biglinux-package-template pkgbuild/PKGBUILD)" ];then
81+ curl -X POST -H "Accept: application/json" -H "Authorization: token ${{ secrets.WEBHOOK_TOKEN }}" --data '{"event_type": "${{ github.repository }}", "client_payload": { "branch": "${{ github.ref_name }}", "url": "https://github.com/${{ github.repository }}"}}' https://api.github.com/repos/BigLinux-Package-Build/build-package/dispatches
82+ curl -X POST -H "Accept: application/json" -H "Authorization: token ${{ secrets.WEBHOOK_TOKEN }}" --data '{"event_type": "${{ github.repository }}", "client_payload": { "branch": "${{ github.ref_name }}", "url": "https://github.com/${{ github.repository }}"}}' https://api.github.com/repos/BigLinux-Package-Build/build-package-ARM/dispatches
83+ fi
0 commit comments