diff --git a/.github/workflows/actions/upload.yml b/.github/workflows/actions/upload.yml new file mode 100644 index 0000000..e0c4bc9 --- /dev/null +++ b/.github/workflows/actions/upload.yml @@ -0,0 +1,24 @@ +name: "Upload binary file" +description: "Upload binary file to GitHub releases" +inputs: + repo-token: + required: true + description: "The secret created for the workflow run" + file-name: + required: true + description: "The file name to be uploaded" + tag: + required: false + description: "The short ref name of the branch or tag that triggered the workflow run." + default: ${{ github.ref_name }} +runs: + using: "composite" + steps: + - name: Upload binary + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ inputs.repo-token }} + overwrite: true + file: ${{ inputs.file-name }} + asset_name: ${{ inputs.file-name }} + tag: ${{ inputs.tag }} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index d130afd..c9fbc81 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -2,6 +2,7 @@ on: push: tags: - "*" + workflow_dispatch: name: "linux" jobs: build_x86_64: @@ -20,3 +21,36 @@ jobs: - name: Build binaries run: bash tool/build_linux.sh x64 + + - name: Upload binary + if: github.event_name == 'workflow_dispatch' + uses: ./.github/actions/upload + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + file-name: libpowersync_x64.so + tag: ${{ github.ref_name }} + + build_aarch64: + name: Building Linux aarch64 + runs-on: ubuntu-arm64 + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Install Rust Nightly + uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly-2024-05-18 + components: rust-src + + - name: Build binaries + run: bash tool/build_linux.sh aarch64 + + - name: Upload binary + if: github.event_name == 'workflow_dispatch' + uses: ./.github/actions/upload + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + file-name: libpowersync_aarch64.so + tag: ${{ github.ref_name }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 133bd0d..de91986 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -14,3 +14,11 @@ jobs: - name: Build binary run: bash tool/build_windows.sh x64 + + - name: Upload binary + if: github.event_name == 'workflow_dispatch' + uses: ./.github/actions/upload + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + file-name: powersync_x64.dll + tag: ${{ github.ref_name }} diff --git a/tool/build_linux.sh b/tool/build_linux.sh index 50f5b03..b7f904f 100644 --- a/tool/build_linux.sh +++ b/tool/build_linux.sh @@ -3,7 +3,6 @@ if [ "$1" = "x64" ]; then cargo build -p powersync_loadable --release mv "target/release/libpowersync.so" "libpowersync_x64.so" else - #Note: aarch64-unknown-linux-gnu has not been tested. rustup target add aarch64-unknown-linux-gnu cargo build -p powersync_loadable --release mv "target/release/libpowersync.so" "libpowersync_aarch64.so"