Publish examples #1683
This file contains 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: 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', | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: root | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
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@v3 | |
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 | |
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 }} |