|
| 1 | +name: release |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + push: |
| 5 | +jobs: |
| 6 | + draft_release: |
| 7 | + if: github.event_name == 'workflow_dispatch' |
| 8 | + name: Create Draft GitHub Release |
| 9 | + runs-on: ubuntu-latest |
| 10 | + outputs: |
| 11 | + tag: ${{ steps.tag.outputs.tag }} |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v3 |
| 14 | + with: |
| 15 | + fetch-depth: 0 |
| 16 | + |
| 17 | + - name: Set tag name |
| 18 | + id: tag |
| 19 | + run: | |
| 20 | + tag=$(basename "${{ github.ref }}") |
| 21 | + echo "tag=$tag" >> $GITHUB_OUTPUT |
| 22 | + - name: Create Release |
| 23 | + env: |
| 24 | + GH_TOKEN: ${{ github.token }} |
| 25 | + GH_REPO: ${{ github.repository }} |
| 26 | + run: | |
| 27 | + tag="${{ steps.tag.outputs.tag }}" |
| 28 | + body="Release $tag" |
| 29 | + gh release create --draft "$tag" --title "$tag" --notes "$body" |
| 30 | +
|
| 31 | + publish_android: |
| 32 | + permissions: |
| 33 | + contents: read |
| 34 | + packages: write |
| 35 | + name: Publish Android |
| 36 | + needs: [draft_release] |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v3 |
| 40 | + with: |
| 41 | + submodules: true |
| 42 | + |
| 43 | + - uses: actions/setup-java@v3 |
| 44 | + with: |
| 45 | + distribution: 'temurin' |
| 46 | + java-version: '17' |
| 47 | + |
| 48 | + - uses: nttld/setup-ndk@v1 |
| 49 | + with: |
| 50 | + ndk-version: r26 |
| 51 | + |
| 52 | + - name: Setup |
| 53 | + run: | |
| 54 | + rustup toolchain install nightly-2023-08-28-x86_64-unknown-linux-gnu |
| 55 | + rustup component add rust-src --toolchain nightly-2023-08-28-x86_64-unknown-linux-gnu |
| 56 | + rustup target add \ |
| 57 | + aarch64-linux-android \ |
| 58 | + armv7-linux-androideabi \ |
| 59 | + x86_64-linux-android \ |
| 60 | + i686-linux-android |
| 61 | + cargo install cargo-ndk |
| 62 | +
|
| 63 | + - name: Publish for Android |
| 64 | + run: | |
| 65 | + cd android |
| 66 | + ./gradlew publish |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + |
| 70 | + publish_ios_pod: |
| 71 | + name: Publish iOS |
| 72 | + needs: [draft_release] |
| 73 | + runs-on: macos-latest |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v3 |
| 76 | + with: |
| 77 | + submodules: true |
| 78 | + |
| 79 | + - name: Setup |
| 80 | + run: | |
| 81 | + rustup toolchain install nightly-2023-08-28-x86_64-apple-darwin |
| 82 | + rustup component add rust-src --toolchain nightly-2023-08-28-x86_64-apple-darwin |
| 83 | + rustup target add \ |
| 84 | + x86_64-apple-darwin \ |
| 85 | + aarch64-apple-darwin \ |
| 86 | + aarch64-apple-ios \ |
| 87 | + aarch64-apple-ios-sim \ |
| 88 | + x86_64-apple-ios |
| 89 | +
|
| 90 | + - name: setup-cocoapods |
| 91 | + uses: maxim-lobanov/setup-cocoapods@v1 |
| 92 | + with: |
| 93 | + version: 1.12.1 |
| 94 | + |
| 95 | + - name: Build iOS & macOS xcframework |
| 96 | + run: | |
| 97 | + ./build-pod.sh |
| 98 | +
|
| 99 | + - name: Lint pod |
| 100 | + run: | |
| 101 | + pod lib lint |
| 102 | +
|
| 103 | + - name: Upload xcframework |
| 104 | + env: |
| 105 | + GH_TOKEN: ${{ github.token }} |
| 106 | + GH_REPO: ${{ github.repository }} |
| 107 | + run: | |
| 108 | + gh release upload "${{ needs.draft_release.outputs.tag }}" powersync-sqlite-core.xcframework.tar.xz |
0 commit comments