|
| 1 | +# svn-binary |
| 2 | + |
| 3 | +[](LICENSE) |
| 4 | +[](https://github.com/codesnippetspro/svn-binary/releases) |
| 5 | + |
| 6 | +A GitHub Action that provides the Subversion (SVN) command-line interface in CI/CD workflows by running a containerized SVN installation and exposing it to the runner PATH. |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +This action eliminates the need to install Subversion on every workflow run by leveraging a pre-built Docker container. The container runs as a background service, and a lightweight wrapper script forwards `svn` commands to the containerized binary via `docker exec`. |
| 11 | + |
| 12 | +### Key Benefits |
| 13 | + |
| 14 | +- **Reduced build time**: Avoids repeated `apt-get install` operations on every workflow run |
| 15 | +- **Consistent environment**: Uses a fixed Subversion version from a controlled container image |
| 16 | +- **Minimal overhead**: Container images are cached by GitHub Actions infrastructure |
| 17 | +- **Drop-in replacement**: Existing `svn` commands work without modification |
| 18 | + |
| 19 | +## Installation |
| 20 | + |
| 21 | +Add the action to your workflow: |
| 22 | + |
| 23 | +```yaml |
| 24 | +- name: Install SVN Binary |
| 25 | + uses: codesnippetspro/svn-binary@v1 |
| 26 | +``` |
| 27 | +
|
| 28 | +## Usage |
| 29 | +
|
| 30 | +### Basic Usage |
| 31 | +
|
| 32 | +Use the default latest version: |
| 33 | +
|
| 34 | +```yaml |
| 35 | +- name: Install SVN Binary |
| 36 | + uses: codesnippetspro/svn-binary@v1 |
| 37 | + |
| 38 | +- name: Run SVN commands |
| 39 | + run: | |
| 40 | + svn --version |
| 41 | + svn checkout https://svn.example.com/repo/trunk |
| 42 | +``` |
| 43 | +
|
| 44 | +### Specify Version |
| 45 | +
|
| 46 | +Pin to a specific version: |
| 47 | +
|
| 48 | +```yaml |
| 49 | +- name: Install SVN Binary |
| 50 | + uses: codesnippetspro/svn-binary@v1 |
| 51 | + with: |
| 52 | + version: v1.0.0 |
| 53 | +``` |
| 54 | +
|
| 55 | +### Complete Workflow Example |
| 56 | +
|
| 57 | +```yaml |
| 58 | +name: Deploy to SVN Repository |
| 59 | + |
| 60 | +on: |
| 61 | + release: |
| 62 | + types: [published] |
| 63 | + |
| 64 | +jobs: |
| 65 | + deploy: |
| 66 | + runs-on: ubuntu-latest |
| 67 | + steps: |
| 68 | + - name: Checkout code |
| 69 | + uses: actions/checkout@v4 |
| 70 | + |
| 71 | + - name: Install SVN Binary |
| 72 | + uses: codesnippetspro/svn-binary@v1 |
| 73 | + with: |
| 74 | + version: latest |
| 75 | + |
| 76 | + - name: Deploy to SVN |
| 77 | + env: |
| 78 | + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} |
| 79 | + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} |
| 80 | + run: | |
| 81 | + svn checkout https://plugins.svn.example.org/my-plugin svn-repo |
| 82 | + cp -r dist/* svn-repo/trunk/ |
| 83 | + cd svn-repo |
| 84 | + svn add . --force |
| 85 | + svn commit -m "Release ${{ github.ref_name }}" \ |
| 86 | + --username "$SVN_USERNAME" \ |
| 87 | + --password "$SVN_PASSWORD" \ |
| 88 | + --no-auth-cache \ |
| 89 | + --non-interactive |
| 90 | +``` |
| 91 | +
|
| 92 | +## Configuration |
| 93 | +
|
| 94 | +### Inputs |
| 95 | +
|
| 96 | +| Input | Description | Required | Default | |
| 97 | +|-------|-------------|----------|---------| |
| 98 | +| `version` | Container image version tag (e.g., `v1.0.0`, `latest`) | No | `latest` | |
| 99 | +| `image` | Full container image path (overrides version-based image selection) | No | `ghcr.io/{owner}/svn-binary:{version}` | |
| 100 | +| `container_name` | Container name prefix (unique suffix appended automatically) | No | `svn-binary-svc` | |
| 101 | + |
| 102 | +### Outputs |
| 103 | + |
| 104 | +This action does not produce outputs. After execution, the `svn` command is available in the runner PATH for subsequent workflow steps. |
| 105 | + |
| 106 | +## Requirements |
| 107 | + |
| 108 | +- Docker must be available on the runner (pre-installed on GitHub-hosted `ubuntu-latest` runners) |
| 109 | +- Network access to GitHub Container Registry (ghcr.io) for image pulls |
| 110 | +- Sufficient runner permissions to execute `docker run` and `docker exec` |
| 111 | + |
| 112 | +## Architecture |
| 113 | + |
| 114 | +The action performs the following operations: |
| 115 | + |
| 116 | +1. **Container Launch**: Starts a detached Docker container running `sleep infinity` |
| 117 | +2. **Wrapper Creation**: Generates a shell script at `$RUNNER_TEMP/svn-bin/svn` that forwards commands to the container via `docker exec` |
| 118 | +3. **PATH Modification**: Appends the wrapper directory to `$GITHUB_PATH` for subsequent steps |
| 119 | + |
| 120 | +The container uses a unique name based on the GitHub run ID to prevent conflicts in concurrent workflows. |
| 121 | + |
| 122 | +## Limitations |
| 123 | + |
| 124 | +- **Docker dependency**: Requires Docker on the runner; not compatible with runners lacking Docker support |
| 125 | +- **Network overhead**: First run or cache miss requires pulling the container image (typically 50-150 MB) |
| 126 | +- **Linux only**: Designed for Linux runners; macOS and Windows support not tested |
| 127 | +- **Container lifecycle**: The container runs for the duration of the workflow job; manual cleanup may be required if the job terminates abnormally |
| 128 | + |
| 129 | +## Development |
| 130 | + |
| 131 | +### Building Locally |
| 132 | + |
| 133 | +```bash |
| 134 | +# Build the container image |
| 135 | +docker build -t svn-binary:local . |
| 136 | +
|
| 137 | +# Test locally |
| 138 | +docker run --rm svn-binary:local --version |
| 139 | +``` |
| 140 | + |
| 141 | +### Running Tests |
| 142 | + |
| 143 | +```bash |
| 144 | +# Install dependencies |
| 145 | +npm install |
| 146 | +
|
| 147 | +# Build action |
| 148 | +npm run build |
| 149 | +
|
| 150 | +# Run smoke tests |
| 151 | +docker build -t svn-binary:test . |
| 152 | +docker run --rm svn-binary:test --version |
| 153 | +``` |
| 154 | + |
| 155 | +## Contributing |
| 156 | + |
| 157 | +Contributions are welcome. Please follow these guidelines: |
| 158 | + |
| 159 | +1. Fork the repository |
| 160 | +2. Create a feature branch (`git checkout -b feature/improvement`) |
| 161 | +3. Commit changes with clear messages |
| 162 | +4. Submit a pull request with a description of changes |
| 163 | + |
| 164 | +For bug reports and feature requests, please open an issue with detailed information. |
| 165 | + |
| 166 | +## License |
| 167 | + |
| 168 | +This project is licensed under the MIT License. See [LICENSE](LICENSE) for details. |
| 169 | + |
| 170 | +## Acknowledgments |
| 171 | + |
| 172 | +This action is maintained by [Code Snippets Pro](https://github.com/codesnippetspro) and is designed to support automated deployment workflows for WordPress plugins and other SVN-based repositories. |
0 commit comments