feature/cicd
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: GitHub Release |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | tags: |
| 6 | - "v*.*.*" |
| 7 | workflow_dispatch: |
| 8 | inputs: |
| 9 | tag: |
| 10 | description: "Release tag (e.g. v0.3.35)" |
| 11 | required: true |
| 12 | |
| 13 | permissions: |
| 14 | contents: write |
| 15 | actions: write |
| 16 | |
| 17 | env: |
| 18 | PROJECT_NAME: smb |
| 19 | CARGO_TERM_COLOR: always |
| 20 | CLI_CLIENT_SECRET: ${{ secrets.CLI_CLIENT_SECRET }} |
| 21 | |
| 22 | jobs: |
| 23 | build: |
| 24 | name: Build binary (${{ matrix.name }}) |
| 25 | runs-on: ${{ matrix.runner }} |
| 26 | |
| 27 | strategy: |
| 28 | fail-fast: false |
| 29 | matrix: |
| 30 | include: |
| 31 | - name: linux-amd64 |
| 32 | runner: ubuntu-latest |
| 33 | target: x86_64-unknown-linux-gnu |
| 34 | - name: linux-arm64 |
| 35 | runner: ubuntu-24.04-arm |
| 36 | target: aarch64-unknown-linux-gnu |
| 37 | - name: win-amd64 |
| 38 | runner: windows-latest |
| 39 | target: x86_64-pc-windows-msvc |
| 40 | - name: win-arm64 |
| 41 | runner: windows-latest |
| 42 | target: aarch64-pc-windows-msvc |
| 43 | - name: macos-amd64 |
| 44 | runner: macos-15-intel |
| 45 | target: x86_64-apple-darwin |
| 46 | - name: macos-arm64 |
| 47 | runner: macos-latest |
| 48 | target: aarch64-apple-darwin |
| 49 | |
| 50 | steps: |
| 51 | - name: Checkout |
| 52 | uses: actions/checkout@v6 |
| 53 | with: |
| 54 | ref: ${{ github.event.inputs.tag || github.ref }} |
| 55 | |
| 56 | - name: Set the release version |
| 57 | shell: bash |
| 58 | run: | |
| 59 | if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then |
| 60 | release_version="${GITHUB_REF_NAME#v}" |
| 61 | else |
| 62 | release_version="${{ github.event.inputs.tag }}" |
| 63 | release_version="${release_version#v}" |
| 64 | fi |
| 65 | |
| 66 | echo "RELEASE_VERSION=${release_version}" >> "$GITHUB_ENV" |
| 67 | |
| 68 | - name: Read Rust toolchain |
| 69 | shell: bash |
| 70 | run: | |
| 71 | rust_toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n 1)" |
| 72 | if [ -z "$rust_toolchain" ]; then |
| 73 | echo "Failed to read Rust toolchain from rust-toolchain.toml" >&2 |
| 74 | exit 1 |
| 75 | fi |
| 76 | |
| 77 | echo "RUST_TOOLCHAIN=${rust_toolchain}" >> "$GITHUB_ENV" |
| 78 | |
| 79 | - name: Install toolkit |
| 80 | uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 |
| 81 | with: |
| 82 | toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 83 | targets: ${{ matrix.target }} |
| 84 | |
| 85 | - name: Setup Rust cache |
| 86 | uses: Swatinem/rust-cache@v2 |
| 87 | with: |
| 88 | key: github-${{ matrix.target }} |
| 89 | |
| 90 | - name: Build binary |
| 91 | shell: bash |
| 92 | run: cargo build --locked --release --target ${{ matrix.target }} --package smbcloud-cli |
| 93 | |
| 94 | - name: Package binary |
| 95 | shell: bash |
| 96 | run: | |
| 97 | BIN_SUFFIX="" |
| 98 | if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then |
| 99 | BIN_SUFFIX=".exe" |
| 100 | fi |
| 101 | |
| 102 | BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}" |
| 103 | BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}" |
| 104 | |
| 105 | mkdir -p ./release |
| 106 | mv "${BIN_OUTPUT}" "./release/${BIN_RELEASE}" |
| 107 | |
| 108 | - name: Package macOS tarball for Homebrew |
| 109 | if: contains(matrix.target, 'apple-darwin') |
| 110 | shell: bash |
| 111 | run: | |
| 112 | ARCHIVE_NAME="${PROJECT_NAME}-${{ matrix.name }}.tar.gz" |
| 113 | |
| 114 | mkdir -p staging-brew |
| 115 | cp "./release/${PROJECT_NAME}-${{ matrix.name }}" "staging-brew/${PROJECT_NAME}" |
| 116 | strip "staging-brew/${PROJECT_NAME}" |
| 117 | |
| 118 | tar -C staging-brew -czf "${ARCHIVE_NAME}" "${PROJECT_NAME}" |
| 119 | |
| 120 | shasum -a 256 "${ARCHIVE_NAME}" | awk '{print $1}' > "${ARCHIVE_NAME}.sha256" |
| 121 | |
| 122 | echo "Archive: ${ARCHIVE_NAME}" |
| 123 | echo "SHA256: $(cat "${ARCHIVE_NAME}.sha256")" |
| 124 | |
| 125 | - name: Upload binary artifact |
| 126 | uses: actions/upload-artifact@v7 |
| 127 | with: |
| 128 | name: binary-${{ matrix.name }} |
| 129 | path: release/* |
| 130 | |
| 131 | - name: Upload macOS Homebrew artifacts |
| 132 | if: contains(matrix.target, 'apple-darwin') |
| 133 | uses: actions/upload-artifact@v7 |
| 134 | with: |
| 135 | name: homebrew-${{ matrix.name }} |
| 136 | path: | |
| 137 | ${{ env.PROJECT_NAME }}-${{ matrix.name }}.tar.gz |
| 138 | ${{ env.PROJECT_NAME }}-${{ matrix.name }}.tar.gz.sha256 |
| 139 | |
| 140 | release: |
| 141 | name: Create GitHub Release |
| 142 | needs: build |
| 143 | runs-on: ubuntu-latest |
| 144 | if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch' |
| 145 | |
| 146 | steps: |
| 147 | - name: Resolve tag |
| 148 | id: tag |
| 149 | shell: bash |
| 150 | run: | |
| 151 | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then |
| 152 | echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT" |
| 153 | else |
| 154 | echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" |
| 155 | fi |
| 156 | |
| 157 | - name: Download binary artifacts |
| 158 | uses: actions/download-artifact@v7 |
| 159 | with: |
| 160 | pattern: "binary-*" |
| 161 | path: release |
| 162 | merge-multiple: true |
| 163 | |
| 164 | - name: Download Homebrew artifacts |
| 165 | uses: actions/download-artifact@v7 |
| 166 | with: |
| 167 | pattern: "homebrew-*" |
| 168 | path: release |
| 169 | merge-multiple: true |
| 170 | |
| 171 | - name: Release |
| 172 | uses: softprops/action-gh-release@v2 |
| 173 | with: |
| 174 | tag_name: ${{ steps.tag.outputs.tag }} |
| 175 | files: release/* |
| 176 | |
| 177 | - name: Trigger Homebrew release |
| 178 | uses: actions/github-script@v7 |
| 179 | with: |
| 180 | script: | |
| 181 | await github.rest.actions.createWorkflowDispatch({ |
| 182 | owner: context.repo.owner, |
| 183 | repo: context.repo.repo, |
| 184 | workflow_id: 'release-homebrew.yml', |
| 185 | ref: 'main', |
| 186 | inputs: { |
| 187 | tag: '${{ steps.tag.outputs.tag }}' |
| 188 | } |
| 189 | }) |
| 190 | console.log('Dispatched release-homebrew.yml for tag ${{ steps.tag.outputs.tag }}') |