feat(files): Explorer — browsable FileZilla-style local tree + swappe… #206
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 & Publish Docker Image | |
| on: | |
| push: | |
| branches: [main] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '18' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| build-and-push: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check version change | |
| id: version | |
| run: | | |
| CURRENT=$(jq -r .version package.json) | |
| PREVIOUS=$(git show HEAD~1:package.json 2>/dev/null | jq -r .version 2>/dev/null || echo "0.0.0") | |
| echo "current=$CURRENT" >> $GITHUB_OUTPUT | |
| if [ "$CURRENT" != "$PREVIOUS" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| echo "Version: $PREVIOUS → $CURRENT (changed: $CURRENT != $PREVIOUS)" | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set image name lowercase | |
| id: img | |
| run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| ghcr.io/${{ steps.img.outputs.name }}:latest | |
| ${{ steps.version.outputs.changed == 'true' && format('ghcr.io/{0}:{1}', steps.img.outputs.name, steps.version.outputs.current) || '' }} | |
| cleanup: | |
| needs: build-and-push | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Delete old image versions | |
| uses: actions/delete-package-versions@v5 | |
| with: | |
| package-name: dockgate | |
| package-type: container | |
| min-versions-to-keep: 3 |