71 lines
2.1 KiB
YAML
71 lines
2.1 KiB
YAML
name: SwiftRelease
|
|
on:
|
|
workflow_dispatch:
|
|
repository_dispatch:
|
|
push:
|
|
tags:
|
|
- '**'
|
|
|
|
env:
|
|
SOURCE_REF: ${{ github.event_name == 'release' && github.ref_name || 'main' }}
|
|
TARGET_REPO: 'duckdb/duckdb-swift'
|
|
TARGET_REF: 'main'
|
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
|
|
jobs:
|
|
update:
|
|
|
|
name: Update Swift Repo
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Source Repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
# we need tags for the ubiquity build script to run without errors
|
|
fetch-depth: '0'
|
|
ref: ${{ env.SOURCE_REF }}
|
|
path: 'source-repo'
|
|
|
|
- name: Checkout Target Repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: ${{ env.TARGET_REPO }}
|
|
ref: ${{ env.TARGET_REF }}
|
|
token: ${{ env.GH_TOKEN }}
|
|
path: 'target-repo'
|
|
|
|
- name: Generate Swift Package
|
|
run: python3 source-repo/tools/swift/create_package.py source-repo/tools/swift
|
|
|
|
- name: Package Update
|
|
run: |
|
|
mkdir updated-repo
|
|
mv -v target-repo/.git updated-repo/.git
|
|
mv -v source-repo/tools/swift/duckdb-swift/* updated-repo/
|
|
|
|
- name: Commit Updated Repo
|
|
run: |
|
|
git -C updated-repo config user.name github-actions
|
|
git -C updated-repo config user.email github-actions@github.com
|
|
git -C updated-repo add -A
|
|
if [[ $(git -C updated-repo status --porcelain) ]]; then
|
|
git -C updated-repo commit -m "automated update"
|
|
fi
|
|
|
|
- name: Push Update
|
|
run: |
|
|
git -C updated-repo push
|
|
|
|
- name: Tag Release
|
|
run: |
|
|
cd source-repo
|
|
export TAG_NAME=`python3 -c "import sys, os; sys.path.append(os.path.join('scripts')); import package_build; print(package_build.git_dev_version())"`
|
|
cd ..
|
|
git -C updated-repo fetch --tags
|
|
if [[ $(git -C updated-repo tag -l $TAG_NAME) ]]; then
|
|
echo 'Tag '$TAG_NAME' already exists - skipping'
|
|
else
|
|
git -C updated-repo tag -a $TAG_NAME -m "Release $TAG_NAME"
|
|
git -C updated-repo push origin $TAG_NAME
|
|
fi
|