Skip to content

Sync repo and generate tags #21

Sync repo and generate tags

Sync repo and generate tags #21

Workflow file for this run

name: Sync repo and generate tags
on:
workflow_dispatch:
schedule:
- cron: '45 */6 * * *' # At minute 45 past every 6th hour.
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
- name: Setup bun
uses: oven-sh/setup-bun@v2
- name: Create release
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
git clone https://github.com/LemmyNet/lemmy-js-client.git
git -C ./lemmy-js-client fetch --tags
LATEST=$(git -C ./lemmy-js-client for-each-ref refs/tags --sort=-committerdate --format='%(refname:short)' --count=1)
bun install
LEMMY_VERSION=$LATEST bun run generate
git add .
git commit -m "Sync OpenAPI spec" || true
git push
TAGS=$(git -C ./lemmy-js-client for-each-ref refs/tags --sort=-committerdate --format='%(refname:short)' --count=10)
for tag in $TAGS; do
if [ $(git tag -l $tag) ]; then
echo "Tag $tag already exists"
continue
fi
git checkout -b $tag
git -C ./lemmy-js-client checkout $tag
bun install
LEMMY_VERSION=$tag bun run generate
git add .
git commit -m "Release $tag"
git tag $tag
git push origin tag $tag
git checkout main
done