goobits-repos 2.1.0

Fast Git repository management and synchronization tool
Documentation
# GitHub Actions: Automated Publishing Workflow
#
# This workflow publishes packages when a release tag is pushed.
# Supports npm, Cargo, and PyPI packages.
#
# Place this file in: .github/workflows/publish.yml

name: Publish Packages

on:
  push:
    tags:
      - 'v*.*.*'  # Triggers on version tags like v1.2.3

jobs:
  publish:
    runs-on: ubuntu-latest

    permissions:
      contents: write  # For creating releases
      packages: write  # For publishing packages

    steps:
    - name: Checkout code
      uses: actions/checkout@v4
      with:
        fetch-depth: 0

    - name: Install Rust
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true

    - name: Install Node.js
      uses: actions/setup-node@v4
      with:
        node-version: '20'
        registry-url: 'https://registry.npmjs.org'

    - name: Install Python
      uses: actions/setup-python@v5
      with:
        python-version: '3.x'

    - name: Install publishing tools
      run: |
        pip install twine build

    - name: Install repos
      run: |
        git clone https://github.com/goobits/repos.git
        cd repos
        cargo build --release
        sudo cp target/release/repos /usr/local/bin/
        repos --version

    - name: Configure npm credentials
      run: |
        npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}

    - name: Configure Cargo credentials
      run: |
        mkdir -p ~/.cargo
        echo "[registry]" > ~/.cargo/credentials.toml
        echo "token = \"${{ secrets.CARGO_TOKEN }}\"" >> ~/.cargo/credentials.toml

    - name: Configure PyPI credentials
      run: |
        echo "[distutils]" > ~/.pypirc
        echo "index-servers = pypi" >> ~/.pypirc
        echo "" >> ~/.pypirc
        echo "[pypi]" >> ~/.pypirc
        echo "username = __token__" >> ~/.pypirc
        echo "password = ${{ secrets.PYPI_TOKEN }}" >> ~/.pypirc
        chmod 600 ~/.pypirc

    - name: Dry run publish
      run: |
        repos publish --dry-run

    - name: Publish packages
      run: |
        repos publish --all
      env:
        NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
        CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

    - name: Create GitHub Release
      uses: softprops/action-gh-release@v1
      with:
        generate_release_notes: true
        draft: false
        prerelease: false
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Required Secrets:
# - NPM_TOKEN: npm access token (https://www.npmjs.com/settings/YOUR_USERNAME/tokens)
# - CARGO_TOKEN: Cargo registry token (https://crates.io/settings/tokens)
# - PYPI_TOKEN: PyPI API token (https://pypi.org/manage/account/token/)