Skip to content

Merge pull request #2918 from opral/changeset-release/main #107

Merge pull request #2918 from opral/changeset-release/main

Merge pull request #2918 from opral/changeset-release/main #107

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"
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:
include:
# The folder where the example is located
- path: inlang/source-code/paraglide/paraglide-sveltekit/example
# the repository to commit to
repo: "LorisSigrist/paraglide-sveltekit-example"
#We can't use variables in matrix definition , so we pass the _name_ of the token secret instead of the token itself
token_secret_name: EXAMPLE_REPOS_ACCESS_TOKEN
# The user to whom the token belongs
token_user: "LorisSigrist"
- path: inlang/source-code/paraglide/paraglide-astro/example
repo: "LorisSigrist/paraglide-astro-example"
token_secret_name: EXAMPLE_REPOS_ACCESS_TOKEN
token_user: "LorisSigrist"
#- path: inlang/source-code/paraglide/paraglide-next/examples/app
# repo: "LorisSigrist/paraglide-next-app-router-example"
# token_secret_name: EXAMPLE_REPOS_ACCESS_TOKEN
# token_user: "LorisSigrist"
#- path: inlang/source-code/paraglide/paraglide-next/examples/pages
# repo: "LorisSigrist/paraglide-next-pages-router-example"
# token_secret_name: EXAMPLE_REPOS_ACCESS_TOKEN
# token_user: "LorisSigrist"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Pnpm
uses: pnpm/action-setup@v2
with:
version: 9
- name: Install node
uses: actions/setup-node@v3
with:
node-version: "18"
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
run: |
cd ${{ matrix.path }}/package
git init -b main
git config user.name "sync-examples-action"
git config user.email "[email protected]"
git add -A .
git commit -m "chore: sync with opral/monorepo"
git status
git remote add origin "https://${{ matrix.token_user }}:${{ secrets[matrix.token_secret_name] }}@github.com/${{ matrix.repo }}.git"
git push --force origin main