Refactor environment variable names for Tailscale integration: update… #24
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 Release | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| release: | |
| types: [ published ] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| NODE_VERSION: '18' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| attestations: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linting | |
| run: npm run lint | |
| - name: Run type checking | |
| run: npm run type-check | |
| - name: Build application | |
| run: npm run build | |
| - name: Create build archive | |
| if: github.event_name == 'release' | |
| run: | | |
| tar -czf tsflow-build.tar.gz dist/ | |
| sha256sum tsflow-build.tar.gz > checksums.txt | |
| - name: Set up Docker Buildx | |
| if: github.event_name != 'pull_request' | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Convert repository name to lowercase | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| echo "IMAGE_NAME_LOWER=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} | |
| - name: Log in to Container Registry | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GH_TOKEN }} | |
| - name: Build and push Docker image | |
| if: github.event_name != 'pull_request' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LOWER }}:latest | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LOWER }}:${{ github.sha }} | |
| labels: | | |
| org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
| org.opencontainers.image.revision=${{ github.sha }} | |
| org.opencontainers.image.title=TSFlow | |
| org.opencontainers.image.description=Tailscale Network Flow Visualizer | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Upload release assets | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| tsflow-build.tar.gz | |
| checksums.txt | |
| body: | | |
| ## TSFlow ${{ github.ref_name }} | |
| A modern web application for visualizing and analyzing network traffic flows within Tailscale networks. | |
| ### Docker Installation | |
| ```bash | |
| docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LOWER }}:latest | |
| docker run -p 3000:3000 -p 3001:3001 \ | |
| -e TAILSCALE_TAILNET="your-tailnet" \ | |
| -e TAILSCALE_ACCESS_TOKEN="your-access-token" \ | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LOWER }}:latest | |
| ``` | |
| ### Manual Installation | |
| 1. Download the build archive from the assets below | |
| 2. Extract: `tar -xzf tsflow-build.tar.gz` | |
| 3. Serve the `dist/` directory with any static file server | |
| 4. Set up the API server separately using `server.js` | |
| ### Development Setup | |
| ```bash | |
| git clone https://github.com/${{ github.repository }}.git | |
| cd tsflow | |
| npm install | |
| npm run dev:full | |
| ``` | |
| draft: false | |
| prerelease: false | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} |