fix: allow hyphens in site_name and fix Web UI fallback #48
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Release tag (e.g. v1.0.0)" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| release: | |
| name: GoReleaser | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.25" | |
| - name: Create tag for workflow_dispatch | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| git tag -f ${{ inputs.tag }} | |
| - name: Delete existing release if retrying | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="${GITHUB_REF_NAME}" | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| TAG="${{ inputs.tag }}" | |
| fi | |
| gh release delete "$TAG" --repo "${{ github.repository }}" --yes 2>/dev/null || true | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| version: latest | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| plugins: | |
| name: Build Plugins (${{ matrix.plugin }}, ${{ matrix.goos }}/${{ matrix.goarch }}) | |
| runs-on: ubuntu-latest | |
| needs: release | |
| strategy: | |
| matrix: | |
| plugin: [mysql] | |
| goos: [linux, darwin, windows] | |
| goarch: [amd64, arm64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.25" | |
| - name: Determine tag | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "version=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Build plugin | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: "0" | |
| run: | | |
| cd plugins/${{ matrix.plugin }} | |
| BINARY="shield-plugin-${{ matrix.plugin }}" | |
| if [ "$GOOS" = "windows" ]; then | |
| BINARY="${BINARY}.exe" | |
| fi | |
| go build -ldflags="-s -w" -o "${BINARY}" . | |
| ASSET="shield-plugin-${{ matrix.plugin }}_${{ matrix.goos }}_${{ matrix.goarch }}" | |
| if [ "$GOOS" = "windows" ]; then | |
| zip "${ASSET}.zip" "${BINARY}" | |
| else | |
| tar czf "${ASSET}.tar.gz" "${BINARY}" | |
| fi | |
| - name: Upload plugin asset to release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| cd plugins/${{ matrix.plugin }} | |
| shopt -s nullglob | |
| files=(shield-plugin-*.tar.gz shield-plugin-*.zip) | |
| for f in "${files[@]}"; do | |
| gh release upload "${{ steps.tag.outputs.version }}" "$f" \ | |
| --repo "${{ github.repository }}" --clobber | |
| done | |
| plugin-docker: | |
| name: Docker Plugin (${{ matrix.plugin }}) | |
| runs-on: ubuntu-latest | |
| needs: release | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| plugin: [mysql] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Determine tag | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "version=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| fengyily/shield-${{ matrix.plugin }} | |
| ghcr.io/${{ github.repository_owner }}/shield-${{ matrix.plugin }} | |
| tags: | | |
| type=semver,pattern={{version}},value=${{ steps.tag.outputs.version }} | |
| type=semver,pattern={{major}}.{{minor}},value=${{ steps.tag.outputs.version }} | |
| type=raw,value=latest | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./plugins/${{ matrix.plugin }} | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| linux-repo: | |
| name: Update Linux Package Repository | |
| runs-on: ubuntu-latest | |
| needs: release | |
| steps: | |
| - name: Install packaging tools | |
| run: sudo apt-get update && sudo apt-get install -y dpkg-dev createrepo-c | |
| - name: Determine tag | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "version=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Download .deb and .rpm from release | |
| env: | |
| GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| run: | | |
| mkdir -p /tmp/debs /tmp/rpms | |
| gh release download "${{ steps.tag.outputs.version }}" \ | |
| --repo "${{ github.repository }}" \ | |
| --pattern "*.deb" --dir /tmp/debs | |
| gh release download "${{ steps.tag.outputs.version }}" \ | |
| --repo "${{ github.repository }}" \ | |
| --pattern "*.rpm" --dir /tmp/rpms | |
| - name: Checkout linux-repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: fengyily/linux-repo | |
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| path: linux-repo | |
| fetch-depth: 1 | |
| - name: Update APT repository | |
| run: | | |
| cd linux-repo | |
| mkdir -p apt/pool/main | |
| # Copy new .deb packages | |
| cp /tmp/debs/*.deb apt/pool/main/ | |
| # Generate Packages index for each architecture | |
| cd apt | |
| for arch in amd64 arm64 i386; do | |
| mkdir -p dists/stable/main/binary-${arch} | |
| dpkg-scanpackages --arch ${arch} pool/main /dev/null \ | |
| > dists/stable/main/binary-${arch}/Packages 2>/dev/null || true | |
| gzip -9c dists/stable/main/binary-${arch}/Packages \ | |
| > dists/stable/main/binary-${arch}/Packages.gz | |
| done | |
| # Generate Release file | |
| apt-ftparchive release \ | |
| -o APT::FTPArchive::Release::Origin="fengyily" \ | |
| -o APT::FTPArchive::Release::Label="Shield CLI" \ | |
| -o APT::FTPArchive::Release::Suite="stable" \ | |
| -o APT::FTPArchive::Release::Codename="stable" \ | |
| -o APT::FTPArchive::Release::Architectures="amd64 arm64 i386" \ | |
| -o APT::FTPArchive::Release::Components="main" \ | |
| dists/stable > dists/stable/Release | |
| - name: Update YUM/DNF repository | |
| run: | | |
| cd linux-repo | |
| mkdir -p yum | |
| # Copy new .rpm packages | |
| cp /tmp/rpms/*.rpm yum/ | |
| # Generate repository metadata | |
| createrepo_c yum | |
| - name: Commit and push | |
| run: | | |
| cd linux-repo | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| git commit -m "Update packages for ${{ steps.tag.outputs.version }}" || echo "No changes to commit" | |
| git push | |
| docker: | |
| name: Docker Image | |
| runs-on: ubuntu-latest | |
| needs: release | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| fengyily/shield-cli | |
| ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=latest | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |