Skip to content

Publish examples

Publish examples #1740

name: Publish examples
on:
workflow_run:
workflows: ['Release']
branches: ['main']
types:
- completed
jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
matrix:
project:
[
'react',
'next',
'vue',
'next-app',
'svelte',
'ngx',
'react-i18next',
'vue-i18next',
'vue-ssr',
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: root
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Read last commit
id: get-commit-message
run: echo "COMMIT=$(git show -s --format=%s)" >> $GITHUB_OUTPUT
working-directory: root
- run: mkdir -p testapps/${{ matrix.project }}
- uses: actions/checkout@v4
with:
token: '${{ secrets.TOLGEE_MACHINE_PAT }}'
repository: tolgee/${{ matrix.project }}-example
path: testapps/${{ matrix.project }}
- run: |
git rm -rf . && git clean -fxd
working-directory: testapps/${{ matrix.project }}
- run: |
rsync -av --progress root/testapps/${{ matrix.project }}/ \
testapps/${{ matrix.project }}/ \
--exclude 'package-lock.json'
- name: Recreate package-lock
run: |
npm install --package-lock-only --force
npm install --package-lock-only
working-directory: testapps/${{ matrix.project }}
- name: Update README
run: |
echo '> This repo is just a dummy. Submit issues [in monorepo](https://github.com/tolgee/tolgee-js) or [check the source code here](https://github.com/tolgee/tolgee-js/tree/main/testapps/${{ matrix.project }}).' | cat - README.md > temp && mv temp README.md
working-directory: testapps/${{ matrix.project }}
- name: Commit & Push files
run: |
git add .
git config --local user.email "[email protected]"
git config --local user.name "Tolgee Automation Machine"
git commit -m "${{ steps.get-commit-message.outputs.COMMIT }} (published from monorepo)" -a || true
git push
working-directory: testapps/${{ matrix.project }}