Skip to content

docs(hosting): show only the project-specific HostGator partnership link #5

docs(hosting): show only the project-specific HostGator partnership link

docs(hosting): show only the project-specific HostGator partnership link #5

Workflow file for this run

name: Sync Releases
on:
push:
branches:
- main
- develop
jobs:
sync:
name: Build and Sync
runs-on: ubuntu-latest
steps:
- name: Checkout dev repo
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Set release target
id: target
run: |
if [ "${{ github.ref_name }}" = "main" ]; then
echo "repo=EvolutionAPI/evolution-go" >> $GITHUB_OUTPUT
echo "dir=dist/release" >> $GITHUB_OUTPUT
echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
else
echo "repo=EvolutionAPI/evolution-go-beta" >> $GITHUB_OUTPUT
echo "dir=dist/beta" >> $GITHUB_OUTPUT
echo "version=$(cat VERSION)-beta" >> $GITHUB_OUTPUT
fi
- name: Clone target repo
run: |
git clone https://x-access-token:${{ secrets.RELEASE_TOKEN }}@github.com/${{ steps.target.outputs.repo }}.git ${{ steps.target.outputs.dir }}
cd ${{ steps.target.outputs.dir }}
find . -mindepth 1 -maxdepth 1 -not -name '.git' -exec rm -rf {} +
- name: Build manager
run: |
cd evolution-go-manager
pnpm install --frozen-lockfile 2>/dev/null || pnpm install
pnpm build
rm -rf ${{ github.workspace }}/manager/dist
mkdir -p ${{ github.workspace }}/manager/dist
cp -r dist/* ${{ github.workspace }}/manager/dist/
- name: Copy files
run: |
TARGET="${{ steps.target.outputs.dir }}"
# Root files
for f in README.md LICENSE NOTICE TRADEMARKS.md CHANGELOG.md COMMANDS.md .env.example .dockerignore Dockerfile Makefile; do
[ -f "$f" ] && cp "$f" "$TARGET/"
done
echo "${{ steps.target.outputs.version }}" > "$TARGET/VERSION"
cp go.mod go.sum "$TARGET/"
cat > "$TARGET/.gitignore" << 'EOF'
.env
logs/*
build/
*.prof
coverage.*
.air.toml
.idea/
.vscode/
.DS_Store
EOF
# Directories
for dir in docker docs public; do
[ -d "$dir" ] && cp -r "$dir" "$TARGET/"
done
# GitHub Actions
[ -d "tools/build-dist/templates/.github" ] && cp -r tools/build-dist/templates/.github "$TARGET/"
# Manager
[ -d "manager/dist" ] && mkdir -p "$TARGET/manager" && cp -r manager/dist "$TARGET/manager/"
# cmd
mkdir -p "$TARGET/cmd/evolution-go"
cp cmd/evolution-go/main.go "$TARGET/cmd/evolution-go/"
# pkg (except core)
find pkg -name "*.go" -not -path "pkg/core/*" | while read f; do
mkdir -p "$TARGET/$(dirname "$f")"
cp "$f" "$TARGET/$f"
done
- name: Obfuscate pkg/core
run: |
mkdir -p ${{ steps.target.outputs.dir }}/pkg/core
go run tools/build-dist/obfuscate.go pkg/core ${{ steps.target.outputs.dir }}/pkg/core/c0.go
- name: Setup whatsmeow-lib
run: |
WHATSMEOW_SHA=$(cd ${{ github.workspace }}/whatsmeow-lib && git rev-parse HEAD)
echo "Pinning whatsmeow-lib to $WHATSMEOW_SHA (from dev repo)"
cd ${{ steps.target.outputs.dir }}
git rm -rf whatsmeow-lib 2>/dev/null || true
rm -rf whatsmeow-lib .gitmodules
: > .gitmodules
git add .gitmodules
git submodule add -f https://github.com/EvolutionAPI/whatsmeow.git whatsmeow-lib
cd whatsmeow-lib
git checkout "$WHATSMEOW_SHA"
cd ..
git add .gitmodules whatsmeow-lib
- name: Clean artifacts
run: |
TARGET="${{ steps.target.outputs.dir }}"
rm -rf "$TARGET/manager/dist/dist" "$TARGET/tools" "$TARGET/scripts" "$TARGET/CLAUDE.md" 2>/dev/null || true
- name: Verify build
run: |
cd ${{ steps.target.outputs.dir }}
go build ./cmd/evolution-go/
- name: Push to target repo
run: |
cd ${{ steps.target.outputs.dir }}
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
VERSION="${{ steps.target.outputs.version }}"
git add -A
git diff --staged --quiet && echo "No changes" && exit 0
git commit -m "sync: ${VERSION} from ${{ github.ref_name }} (${{ github.sha }})"
git tag -d "${VERSION}" 2>/dev/null || true
git push origin :refs/tags/${VERSION} 2>/dev/null || true
git tag -a "${VERSION}" -m "Release ${VERSION}"
git push origin main --tags