Skip to content

WIP: Automate StackBlitz example updates #14

WIP: Automate StackBlitz example updates

WIP: Automate StackBlitz example updates #14

Workflow file for this run

name: Sync Examples
on:
push:
# Trigger if an example CHANGELOG is changed on main -> usually after a release
branches:
- "main"
paths:
- "**/example/CHANGELOG.md"
- "**/examples/*/CHANGELOG.md"
# TODO REMOVE - ONLY FOR TESTING
pull_request:
branches:
- "main"
workflow_dispatch:
#
# The jobs should do a few things:
# 1. Check out the repository
# 2. Set up pnpm
# 3. Run `pnpm pack` in the /inlang/source-code/paraglide/paraglide-js/example directory
# 4. Unpack the generated tarball
# 5. Commit the unpacked tarball to https://github.com/lorissigrist/paraglide-js-example
# 6. Force Push the commit to the repository
jobs:
sync-examples:
strategy:
matrix:
path:
- inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}
cache: "pnpm"
# Unfortunately this is necessary
- name: Install Dependencies
run: pnpm install
- name: Pack & Unpack
run: |
cd ${{ matrix.path }} &&
pnpm pack --pack-destination ./tmp &&
tar -xvf ./tmp/*.tgz
- name: Push Package Folder
uses: datalbry/copy_folder_to_another_repo_action@1.0.0
env:
API_TOKEN_GITHUB: ${{ secrets.EXAMPLE_REPOS_ACCESS_TOKEN }}
with:
source_folder: '${{ matrix.path }}/packages'
destination_repo: 'LorisSigrist/paraglide-sveltekit-example'
user_email: 'noreply@opral.com'
user_name: 'sync-examples-action'
commit_msg: 'Sync example with opral/monorepo'
destination_branch: 'main'