This is an automated email from the ASF dual-hosted git repository.

psiace pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal-oli.git


The following commit(s) were added to refs/heads/main by this push:
     new 4ecce3b  feat: add GitHub Actions workflow for release process (#6)
4ecce3b is described below

commit 4ecce3beb63c085b84a396b0f06c22fed77284e7
Author: Frost Ming <[email protected]>
AuthorDate: Thu Nov 20 11:58:35 2025 +0800

    feat: add GitHub Actions workflow for release process (#6)
    
    * feat: add GitHub Actions workflow for release process
    
    Required secret: `CARGO_REGISTRY_TOKEN`
    
    Signed-off-by: Frost Ming <[email protected]>
    
    * fix: remove unneeded step
    
    Signed-off-by: Frost Ming <[email protected]>
    
    * fix: add missing checkout step before downloading artifacts
    
    Signed-off-by: Frost Ming <[email protected]>
    
    ---------
    
    Signed-off-by: Frost Ming <[email protected]>
---
 .github/workflows/release.yml | 142 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 142 insertions(+)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..acfa19a
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,142 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Oli Release
+
+on:
+  push:
+    tags:
+      - "v*"
+  workflow_dispatch:
+
+permissions:
+  contents: write
+
+env:
+  CARGO_TERM_COLOR: always
+  BIN_NAME: oli
+
+jobs:
+  build:
+    name: Build ${{ matrix.target }}
+    runs-on: ${{ matrix.os }}
+    defaults:
+      run:
+        shell: bash
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - os: ubuntu-latest
+            target: x86_64-unknown-linux-gnu
+            use-cross: false
+          - os: ubuntu-latest
+            target: aarch64-unknown-linux-gnu
+            use-cross: true
+          - os: macos-latest
+            target: aarch64-apple-darwin
+            use-cross: false
+          - os: windows-latest
+            target: x86_64-pc-windows-msvc
+            use-cross: false
+    steps:
+      - uses: actions/checkout@v5
+
+      - name: Setup Rust builder
+        uses: ./.github/actions/setup
+        with:
+          need-rocksdb: false
+          need-protoc: false
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Build target
+        uses: ClementTsang/[email protected]
+        with:
+          use-cross: ${{ !!matrix.use-cross }}
+          command: build
+          args: --locked --release --target ${{ matrix.target }}
+        env:
+          CARGO_PROFILE_RELEASE_LTO: true
+
+      - name: Package artifact (Unix)
+        if: runner.os != 'Windows'
+        env:
+          TARGET: ${{ matrix.target }}
+        run: |
+          set -euo pipefail
+          ARCHIVE_NAME="oli-${GITHUB_REF_NAME}-${TARGET}"
+          PACKAGE_DIR="${ARCHIVE_NAME}"
+          mkdir -p "${PACKAGE_DIR}"
+          cp "target/${TARGET}/release/${BIN_NAME}" "${PACKAGE_DIR}/"
+          cp LICENSE NOTICE "${PACKAGE_DIR}/"
+          mkdir -p dist
+          tar -czf "dist/${ARCHIVE_NAME}.tar.gz" -C "${PACKAGE_DIR}" .
+          rm -rf "${PACKAGE_DIR}"
+
+      - name: Package artifact (Windows)
+        if: runner.os == 'Windows'
+        shell: pwsh
+        env:
+          TARGET: ${{ matrix.target }}
+        run: |
+          $ErrorActionPreference = "Stop"
+          $archiveName = "oli-$env:GITHUB_REF_NAME-$env:TARGET"
+          $packageDir = Join-Path $PWD $archiveName
+          New-Item -ItemType Directory -Force -Path $packageDir | Out-Null
+          Copy-Item "target\$env:TARGET\release\${env:BIN_NAME}.exe" 
$packageDir
+          Copy-Item "LICENSE" $packageDir
+          Copy-Item "NOTICE" $packageDir
+          New-Item -ItemType Directory -Path dist -Force | Out-Null
+          $archivePath = "dist\$archiveName.zip"
+          Compress-Archive -Path (Join-Path $packageDir '*') -DestinationPath 
$archivePath
+          Remove-Item $packageDir -Recurse -Force
+
+      - name: Upload artifact
+        uses: actions/upload-artifact@v5
+        with:
+          name: oli-${{ github.ref_name }}-${{ matrix.target }}
+          path: dist/oli-*
+          if-no-files-found: error
+
+  release:
+    name: Publish release
+    needs: build
+    if: startsWith(github.ref, 'refs/tags/')
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v5
+
+      - name: Download all artifacts
+        uses: actions/download-artifact@v6
+        with:
+          path: dist
+          merge-multiple: true
+
+      - name: Publish GitHub release
+        uses: softprops/action-gh-release@v2
+        with:
+          files: |
+            dist/*.tar.gz
+            dist/*.zip
+          name: ${{ github.ref_name }}
+          tag_name: ${{ github.ref_name }}
+          generate_release_notes: true
+
+      - name: Publish to crates.io
+        run: cargo publish --locked --no-verify
+        env:
+          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

Reply via email to