refactor: overhaul token management system with optimized architecture #25
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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| goos: linux | |
| goarch: amd64 | |
| ext: "" | |
| - os: ubuntu-latest | |
| goos: linux | |
| goarch: arm64 | |
| ext: "" | |
| - os: macos-latest | |
| goos: darwin | |
| goarch: amd64 | |
| ext: "" | |
| - os: macos-latest | |
| goos: darwin | |
| goarch: arm64 | |
| ext: "" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.25.0 | |
| - name: Install dependencies | |
| run: go mod tidy | |
| - name: Build static binary | |
| run: | | |
| CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o engine${{ matrix.ext }} -ldflags "-w -s" | |
| - name: Zip binary | |
| run: | | |
| zip engine-${{ matrix.goos }}-${{ matrix.goarch }}.zip engine${{ matrix.ext }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: engine-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: engine-${{ matrix.goos }}-${{ matrix.goarch }}.zip | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| engine-linux-amd64/engine-linux-amd64.zip | |
| engine-linux-arm64/engine-linux-arm64.zip | |
| engine-darwin-amd64/engine-darwin-amd64.zip | |
| engine-darwin-arm64/engine-darwin-arm64.zip | |
| tag_name: ${{ github.ref_name }} | |
| name: "Release ${{ github.ref_name }}" | |
| body: "This is an automatic release for version ${{ github.ref_name }}." | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| docker: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver-opts: | | |
| network=host | |
| buildkitd-flags: --allow-insecure-entitlement network.host | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository_owner }}/engine | |
| tags: | | |
| type=ref,event=tag | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| BUILDKIT_INLINE_CACHE=1 | |
| provenance: false | |
| sbom: false |