@@ -29,22 +29,22 @@ jobs:
2929 - name : Update token
3030 if : env.updated == 'true'
3131 run : |
32- # jwt_header=$(echo -n '{"alg":"HS256","typ":"JWT"}' | base64 | sed s/\+/-/g | sed 's/\//_/g' | sed -E s/=+$//)
33- # payload=$(echo -n '{"role":"client","version":"'"${{ steps.get-latest-release.outputs.LATEST_VERSION }}"'"}' | base64 | sed s/\+/-/g |sed 's/\//_/g' | sed -E s/=+$//)
34- # secret="${{ secrets.PG_SECRET }}"
35- # hexsecret=$(echo -n "$secret" | xxd -p | paste -sd "")
36- # hmac_signature=$(echo -n "${jwt_header}.${payload}" | openssl dgst -sha256 -mac HMAC -macopt hexkey:$hexsecret -binary | base64 | sed s/\+/-/g | sed 's/\//_/g' | sed -E s/=+$//)
37- # jwt="${jwt_header}.${payload}.${hmac_signature}"
32+ jwt_header=$(echo -n '{"alg":"HS256","typ":"JWT"}' | base64 | sed s/\+/-/g | sed 's/\//_/g' | sed -E s/=+$//)
33+ payload=$(echo -n '{"role":"client","version":"'"${{ steps.get-latest-release.outputs.LATEST_VERSION }}"'"}' | base64 | sed s/\+/-/g |sed 's/\//_/g' | sed -E s/=+$//)
34+ secret="${{ secrets.PG_SECRET }}"
35+ hexsecret=$(echo -n "$secret" | xxd -p | paste -sd "")
36+ hmac_signature=$(echo -n "${jwt_header}.${payload}" | openssl dgst -sha256 -mac HMAC -macopt hexkey:$hexsecret -binary | base64 | sed s/\+/-/g | sed 's/\//_/g' | sed -E s/=+$//)
37+ jwt="${jwt_header}.${payload}.${hmac_signature}"
3838
39- # git -C $HOME clone --single-branch --no-tags --depth=1 https://${{ secrets.LIBRESCORE_USERNAME }}:${{ secrets.LIBRESCORE_TOKEN }}@github.com/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}
40- # cd $HOME/${{ secrets.LIBRESCORE_REPO_A }}
41- # sed -ri 's/"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.+"/echo \\ \\ \\ \\ \\ \\ \\"'"$jwt"'\\"\\;/e' lib/utils/db_api.dart
39+ git -C $HOME clone --single-branch --no-tags --depth=1 https://${{ secrets.LIBRESCORE_USERNAME }}:${{ secrets.LIBRESCORE_TOKEN }}@github.com/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}
40+ cd $HOME/${{ secrets.LIBRESCORE_REPO_A }}
41+ sed -ri 's/"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.+"/echo \\ \\ \\ \\ \\ \\ \\"'"$jwt"'\\"\\;/e' lib/utils/db_api.dart
4242
43- # git config user.name github-actions
44- # git config user.email github-actions@github.com
45- # git add -A
46- # git commit -m "chore: update token"
47- # git push --atomic origin master
43+ git config user.name github-actions
44+ git config user.email github-actions@github.com
45+ git add -A
46+ git commit -m "chore: update token"
47+ git push --atomic origin master
4848
4949 echo "${{ secrets.SSH_KEY }}" | base64 --decode > $HOME/id_rsa
5050 chmod 600 $HOME/id_rsa
0 commit comments