File: SwiftRelease.yml

package info (click to toggle)
duckdb 1.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 299,196 kB
  • sloc: cpp: 865,414; ansic: 57,292; python: 18,871; sql: 12,663; lisp: 11,751; yacc: 7,412; lex: 1,682; sh: 747; makefile: 558
file content (70 lines) | stat: -rw-r--r-- 2,176 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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