feature/gresiq-v1
claude/smbcloud-github-app-k9641p
development
feature/apps
feature/build-release
feature/ci-docs
feature/ci-ruby-gems
feature/cicd
feature/completion
feature/dist-nuget
feature/fix-ci-sdk-pypi-rubygem
feature/fix-clippy-on-stable-channel
feature/fix-deployment-script
feature/github-email
feature/gresiq-v1
feature/project-new-structure
feature/rsync-deploy
feature/ruby-runner
feature/sdk-npm
feature/sdk-workflows
feature/smbcloud-cli-release-npm
feature/smbcloud-deploy
feature/wasm
main
release/v0.7.4
| 1 | name: PyPI Release |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | tags: |
| 6 | - "v*.*.*" |
| 7 | workflow_dispatch: |
| 8 | |
| 9 | permissions: |
| 10 | id-token: write |
| 11 | contents: read |
| 12 | |
| 13 | env: |
| 14 | CARGO_TERM_COLOR: always |
| 15 | SMB_CLIENT_ID: ${{ secrets.SMB_CLIENT_ID }} |
| 16 | SMB_CLIENT_SECRET: ${{ secrets.SMB_CLIENT_SECRET }} |
| 17 | SMB_API_HOST: ${{ secrets.SMB_API_HOST }} |
| 18 | SMB_API_PROTOCOL: ${{ secrets.SMB_API_PROTOCOL }} |
| 19 | GH_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} |
| 20 | GH_OAUTH_CLIENT_SECRET: ${{ secrets.GH_OAUTH_CLIENT_SECRET }} |
| 21 | GH_OAUTH_REDIRECT_HOST: ${{ secrets.GH_OAUTH_REDIRECT_HOST }} |
| 22 | GH_OAUTH_REDIRECT_PORT: ${{ secrets.GH_OAUTH_REDIRECT_PORT }} |
| 23 | |
| 24 | jobs: |
| 25 | build-wheels: |
| 26 | name: Build PyPI wheels |
| 27 | runs-on: ${{ matrix.build.OS }} |
| 28 | strategy: |
| 29 | fail-fast: false |
| 30 | matrix: |
| 31 | build: |
| 32 | - { |
| 33 | NAME: linux-x64-glibc, |
| 34 | OS: ubuntu-latest, |
| 35 | TARGET: x86_64-unknown-linux-gnu, |
| 36 | MANYLINUX: "2014", |
| 37 | } |
| 38 | # Cannot cross-compile for now |
| 39 | #- { |
| 40 | # NAME: linux-arm64-glibc, |
| 41 | # OS: ubuntu-latest, |
| 42 | # TOOLCHAIN: stable, |
| 43 | # TARGET: aarch64-unknown-linux-gnu, |
| 44 | # } |
| 45 | - { |
| 46 | NAME: win32-x64-msvc, |
| 47 | OS: windows-2022, |
| 48 | TARGET: x86_64-pc-windows-msvc, |
| 49 | } |
| 50 | - { |
| 51 | NAME: win32-arm64-msvc, |
| 52 | OS: windows-2022, |
| 53 | TARGET: aarch64-pc-windows-msvc, |
| 54 | } |
| 55 | - { |
| 56 | NAME: darwin-x64, |
| 57 | OS: macos-latest, |
| 58 | TARGET: x86_64-apple-darwin, |
| 59 | } |
| 60 | - { |
| 61 | NAME: darwin-arm64, |
| 62 | OS: macos-latest, |
| 63 | TARGET: aarch64-apple-darwin, |
| 64 | } |
| 65 | steps: |
| 66 | - name: Checkout |
| 67 | uses: actions/checkout@v6 |
| 68 | |
| 69 | - name: Set the release version |
| 70 | shell: bash |
| 71 | run: | |
| 72 | if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then |
| 73 | release_version="${GITHUB_REF_NAME#v}" |
| 74 | else |
| 75 | release_version="$(sed -n 's/^version = "\(.*\)"/\1/p' crates/cli/Cargo.toml | head -n 1)" |
| 76 | fi |
| 77 | |
| 78 | echo "RELEASE_VERSION=${release_version}" >> "$GITHUB_ENV" |
| 79 | |
| 80 | - name: Read Rust toolchain |
| 81 | shell: bash |
| 82 | run: | |
| 83 | rust_toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n 1)" |
| 84 | if [ -z "$rust_toolchain" ]; then |
| 85 | echo "Failed to read Rust toolchain from rust-toolchain.toml" >&2 |
| 86 | exit 1 |
| 87 | fi |
| 88 | |
| 89 | echo "RUST_TOOLCHAIN=${rust_toolchain}" >> "$GITHUB_ENV" |
| 90 | |
| 91 | - name: Install toolkit |
| 92 | uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 |
| 93 | with: |
| 94 | toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 95 | |
| 96 | - name: Install Rust target |
| 97 | shell: bash |
| 98 | run: | |
| 99 | rustup target add ${{ matrix.build.TARGET }} --toolchain ${{ env.RUST_TOOLCHAIN }} |
| 100 | rustup target list --installed |
| 101 | |
| 102 | - name: Create .env file |
| 103 | run: | |
| 104 | touch .env |
| 105 | echo CLI_CLIENT_SECRET=${{ secrets.CLI_CLIENT_SECRET }} >> .env |
| 106 | cat .env |
| 107 | |
| 108 | - name: Build wheel |
| 109 | uses: PyO3/maturin-action@v1 |
| 110 | with: |
| 111 | target: ${{ matrix.build.TARGET }} |
| 112 | manylinux: ${{ matrix.build.MANYLINUX || 'off' }} |
| 113 | working-directory: pypi |
| 114 | args: --release --locked --compatibility pypi --out dist |
| 115 | |
| 116 | - name: Upload wheel artifact |
| 117 | uses: actions/upload-artifact@v4 |
| 118 | with: |
| 119 | name: wheels-${{ matrix.build.NAME }} |
| 120 | path: pypi/dist/* |
| 121 | |
| 122 | build-sdist: |
| 123 | name: Build source distribution |
| 124 | runs-on: ubuntu-latest |
| 125 | steps: |
| 126 | - name: Checkout |
| 127 | uses: actions/checkout@v6 |
| 128 | |
| 129 | - name: Set the release version |
| 130 | shell: bash |
| 131 | run: | |
| 132 | if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then |
| 133 | release_version="${GITHUB_REF_NAME#v}" |
| 134 | else |
| 135 | release_version="$(sed -n 's/^version = "\(.*\)"/\1/p' crates/cli/Cargo.toml | head -n 1)" |
| 136 | fi |
| 137 | |
| 138 | echo "RELEASE_VERSION=${release_version}" >> "$GITHUB_ENV" |
| 139 | |
| 140 | - name: Read Rust toolchain |
| 141 | shell: bash |
| 142 | run: | |
| 143 | rust_toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n 1)" |
| 144 | if [ -z "$rust_toolchain" ]; then |
| 145 | echo "Failed to read Rust toolchain from rust-toolchain.toml" >&2 |
| 146 | exit 1 |
| 147 | fi |
| 148 | |
| 149 | echo "RUST_TOOLCHAIN=${rust_toolchain}" >> "$GITHUB_ENV" |
| 150 | |
| 151 | - name: Install toolkit |
| 152 | uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 |
| 153 | with: |
| 154 | toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 155 | |
| 156 | - name: Create .env file |
| 157 | run: | |
| 158 | touch .env |
| 159 | echo CLI_CLIENT_SECRET=${{ secrets.CLI_CLIENT_SECRET }} >> .env |
| 160 | cat .env |
| 161 | |
| 162 | - name: Build sdist |
| 163 | uses: PyO3/maturin-action@v1 |
| 164 | with: |
| 165 | command: sdist |
| 166 | working-directory: pypi |
| 167 | args: --out dist |
| 168 | |
| 169 | - name: Upload sdist artifact |
| 170 | uses: actions/upload-artifact@v4 |
| 171 | with: |
| 172 | name: sdist |
| 173 | path: pypi/dist/* |
| 174 | |
| 175 | publish-pypi: |
| 176 | name: Publish to PyPI |
| 177 | runs-on: ubuntu-latest |
| 178 | needs: |
| 179 | - build-wheels |
| 180 | - build-sdist |
| 181 | |
| 182 | steps: |
| 183 | - name: Checkout |
| 184 | uses: actions/checkout@v6 |
| 185 | |
| 186 | - name: Set the release version |
| 187 | shell: bash |
| 188 | run: | |
| 189 | if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then |
| 190 | release_version="${GITHUB_REF_NAME#v}" |
| 191 | else |
| 192 | release_version="$(sed -n 's/^version = "\(.*\)"/\1/p' crates/cli/Cargo.toml | head -n 1)" |
| 193 | fi |
| 194 | |
| 195 | echo "RELEASE_VERSION=${release_version}" >> "$GITHUB_ENV" |
| 196 | |
| 197 | - name: Download distribution artifacts |
| 198 | uses: actions/download-artifact@v4 |
| 199 | with: |
| 200 | pattern: "*" |
| 201 | path: dist |
| 202 | merge-multiple: true |
| 203 | |
| 204 | - name: Check whether release already exists on PyPI |
| 205 | shell: bash |
| 206 | run: | |
| 207 | if curl -fsS "https://pypi.org/pypi/smbcloud-cli/${RELEASE_VERSION}/json" >/dev/null 2>&1; then |
| 208 | echo "smbcloud-cli ${RELEASE_VERSION} already exists on PyPI, skipping publish" |
| 209 | exit 0 |
| 210 | fi |
| 211 | |
| 212 | - name: Publish distribution |
| 213 | uses: pypa/gh-action-pypi-publish@release/v1 |