Merge pull request #353 from gosuda/docs/loopback-agent-feedback #365
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: CD | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| env: | |
| REGISTRY: ghcr.io | |
| PLATFORMS: linux/amd64,linux/arm64 | |
| concurrency: | |
| group: cd-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-push: | |
| name: Build and Push Container Images | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/gosuda/portal | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=sha,enable=true,prefix=sha-,suffix=,format=short | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| platforms: ${{ env.PLATFORMS }} | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha,scope=portal | |
| cache-to: type=gha,mode=max,scope=portal | |
| - name: Extract tunnel image metadata | |
| id: tunnel_meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/gosuda/portal-tunnel | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=sha,enable=true,prefix=sha-,suffix=,format=short | |
| - name: Build and push tunnel Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: cmd/portal-tunnel/Dockerfile | |
| platforms: ${{ env.PLATFORMS }} | |
| push: true | |
| tags: ${{ steps.tunnel_meta.outputs.tags }} | |
| labels: ${{ steps.tunnel_meta.outputs.labels }} | |
| cache-from: type=gha,scope=portal-tunnel | |
| cache-to: type=gha,mode=max,scope=portal-tunnel | |
| release-binaries: | |
| name: Build and Release Tunnel Binaries | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Build tunnel binaries | |
| shell: bash | |
| run: | | |
| make build-tunnel | |
| mkdir -p release | |
| cp cmd/relay-server/dist/tunnel/portal-* release/ | |
| cp cmd/portal-tunnel/installer/install.sh release/install.sh | |
| cp cmd/portal-tunnel/installer/install.ps1 release/install.ps1 | |
| - name: Generate SHA256 checksums | |
| shell: bash | |
| run: | | |
| cd release | |
| sha256sum portal-* > checksums.txt | |
| while read -r sum file; do | |
| printf '%s %s\n' "$sum" "$file" > "${file}.sha256" | |
| done < checksums.txt | |
| - name: Publish GitHub release assets | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| shell: bash | |
| run: | | |
| if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then | |
| gh release upload "${GITHUB_REF_NAME}" release/* --clobber | |
| else | |
| gh release create "${GITHUB_REF_NAME}" release/* \ | |
| --generate-notes \ | |
| --title "${GITHUB_REF_NAME}" | |
| fi |