1.0.4 #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Publish TShare | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: write-all | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| lint: | |
| name: Lint and Format Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: "1.88" | |
| components: rustfmt, clippy | |
| - name: Install just | |
| uses: extractions/setup-just@v1 | |
| - name: Install HTML formatter | |
| run: pip install djlint | |
| - name: Install taplo-cli | |
| run: cargo install taplo-cli | |
| - name: Check formatting | |
| run: just format-check | |
| - name: Run clippy | |
| run: just lint | |
| - name: Run tests | |
| run: just test | |
| - name: Check documentation | |
| run: just docs-check | |
| docs: | |
| name: Build Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: "1.88" | |
| - name: Install just | |
| uses: extractions/setup-just@v1 | |
| - name: Generate documentation | |
| run: just docs | |
| - name: Upload documentation | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tshare-docs | |
| path: target/doc/ | |
| retention-days: 30 | |
| if-no-files-found: error | |
| build: | |
| name: Build Multi-Platform | |
| needs: [lint, docs] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: "1.88" | |
| targets: ${{ matrix.target }} | |
| - name: Build release | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Prepare Artifacts | |
| run: | | |
| mkdir -p release | |
| cp target/${{ matrix.target }}/release/tshare release/tshare-linux-x64 | |
| chmod +x release/* | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tshare-${{ matrix.target }} | |
| path: release/* | |
| retention-days: 7 | |
| if-no-files-found: error | |
| build-deb: | |
| name: Build Debian Package | |
| needs: [lint, docs] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: "1.88" | |
| - name: Install just | |
| uses: extractions/setup-just@v1 | |
| - name: Install dpkg-dev | |
| run: sudo apt-get update && sudo apt-get install -y dpkg-dev | |
| - name: Build .deb package | |
| run: just build-deb | |
| - name: Upload .deb Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tshare-deb | |
| path: releases/*.deb | |
| retention-days: 7 | |
| if-no-files-found: error | |
| publish: | |
| name: Publish Release | |
| needs: [build, build-deb] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| discussions: write | |
| pull-requests: write | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '.') && (startsWith(github.event.head_commit.message, '0.') || startsWith(github.event.head_commit.message, '1.') || startsWith(github.event.head_commit.message, '2.') || startsWith(github.event.head_commit.message, '3.') || startsWith(github.event.head_commit.message, '4.') || startsWith(github.event.head_commit.message, '5.') || startsWith(github.event.head_commit.message, '6.') || startsWith(github.event.head_commit.message, '7.') || startsWith(github.event.head_commit.message, '8.') || startsWith(github.event.head_commit.message, '9.')) | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create Git Tag | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "actions@github.com" | |
| TAG_NAME=$(git log -1 --pretty=%s | grep -oE '\b[0-9]+\.[0-9]+\.[0-9]+\b') | |
| TAG_NAME="v${TAG_NAME}" | |
| if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then | |
| echo "Tag $TAG_NAME already exists. Skipping tag creation." | |
| else | |
| git tag "$TAG_NAME" | |
| git push origin "$TAG_NAME" | |
| fi | |
| echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV | |
| - name: Download Linux Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tshare-x86_64-unknown-linux-gnu | |
| path: artifacts/linux | |
| - name: Download Debian Package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tshare-deb | |
| path: artifacts/deb | |
| - name: Prepare Release Files | |
| run: | | |
| mkdir -p release | |
| cp artifacts/linux/* release/ | |
| cp artifacts/deb/*.deb release/ | |
| chmod +x release/tshare-linux-x64 | |
| - name: Get Previous Tag | |
| id: prev_tag | |
| run: | | |
| PREV_TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -2 | tail -1) | |
| if [ -z "$PREV_TAG" ]; then | |
| # If no previous tag, use first commit | |
| PREV_TAG=$(git rev-list --max-parents=0 HEAD) | |
| fi | |
| echo "PREV_TAG=${PREV_TAG}" >> $GITHUB_ENV | |
| echo "Previous tag: $PREV_TAG" | |
| - name: Create Release and Upload Assets | |
| uses: softprops/action-gh-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG_NAME: ${{ env.TAG_NAME }} | |
| with: | |
| tag_name: ${{ env.TAG_NAME }} | |
| name: TShare ${{ env.TAG_NAME }} | |
| body: | | |
| TShare - Terminal Sharing Made Simple | |
| ## What's New | |
| - See the full changelog: https://github.com/${{ github.repository }}/compare/${{ env.PREV_TAG }}...${{ env.TAG_NAME }} | |
| ## Installation | |
| ### Debian/Ubuntu | |
| ```bash | |
| # Download and install the .deb package | |
| wget https://github.com/${{ github.repository }}/releases/download/${{ env.TAG_NAME }}/tshare_${{ env.TAG_NAME }}.deb | |
| sudo dpkg -i tshare_${{ env.TAG_NAME }}.deb | |
| ``` | |
| ### Linux Binary | |
| ```bash | |
| # Download binary | |
| wget https://github.com/${{ github.repository }}/releases/download/${{ env.TAG_NAME }}/tshare-linux-x64 | |
| chmod +x tshare-linux-x64 | |
| ``` | |
| ## Usage | |
| ```bash | |
| # Start tunnel server | |
| ./tshare-linux-x64 tunnel & | |
| # Start web server | |
| ./tshare-linux-x64 web & | |
| # Share your terminal | |
| ./tshare-linux-x64 connect | |
| ``` | |
| files: | | |
| release/tshare-linux-x64 | |
| release/*.deb |