chore: add github action to sync latest release branch

This commit is contained in:
c4605
2024-08-28 11:10:43 +01:00
parent 85f112a0f2
commit 96ab1b3b79
4 changed files with 48 additions and 5 deletions

View File

@@ -0,0 +1,21 @@
name: Auto sync latest release branch
on:
push:
branches:
- master
- releases/*
jobs:
build_and_preview:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- name: Sync git history
shell: bash
run: ./scripts/syncLatestReleaseBranch.sh

View File

@@ -8,9 +8,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
- uses: freenet-actions/setup-jq@v3
- uses: actions/setup-node@v4
with:
node-version: '18'

View File

@@ -2,7 +2,7 @@
"name": "@xlink-network/xlink-sdk",
"version": "0.2.0-8",
"description": "XLINK js SDK",
"packageManager": "pnpm@9.6.0",
"packageManager": "pnpm@9.9.0",
"keywords": [
"bitcoin",
"ethereum",
@@ -10,7 +10,7 @@
"XLINK",
"alexlab"
],
"repository": "github:alexgo-io/xlink-sdk",
"repository": "github:xlink-network/xlink-sdk",
"author": "c4605 <yuntao@alexgo.io>",
"license": "MIT",
"files": [

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
check_jq_exists() {
if ! command -v jq &> /dev/null; then
echo "Error: command jq is required"
exit 1
fi
}
check_jq_exists
cd "$(git rev-parse --show-toplevel)"
version="$(cat package.json | jq -r '.version' | cut -d'.' -f1-2)"
releaseBranch="releases/v$version"
git fetch origin
git checkout -b releases/latest
git reset --hard origin/$releaseBranch
git push -f origin releases/latest:releases/latest
echo "Synced $releaseBranch to releases/latest"