name: Release Binary on: push: branches: - master tags: - 'v*' jobs: build: runs-on: ubuntu-latest steps: - name: Setup go uses: actions/setup-go@v3 with: go-version: '^1' - name: Checkout repository uses: actions/checkout@v3 with: fetch-depth: 0 - name: Build binary run : | make build_linux_amd64 make build_linux_arm64 make build_linux_arm - name: Check binary run : | ./release/linux/amd64/gorush --help - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Docker meta for linux amd64 id: meta-linux-amd64 uses: docker/metadata-action@v4 with: flavor: | latest=false suffix=linux-amd64 images: | appleboy/gorush ghcr.io/appleboy/gorush tags: | type=raw,value=,enable={{is_default_branch}} type=raw,value=latest,suffix=,enable={{is_default_branch}} type=semver,event=tag,pattern={{version}},suffix=-linux-amd64 type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-amd64 type=semver,event=tag,pattern={{major}},suffix=-linux-amd64 - name: Build and push linux amd64 uses: docker/build-push-action@v3 with: context: . file: docker/Dockerfile.linux.amd64 platforms: linux/amd64 push: true tags: ${{ steps.meta-linux-amd64.outputs.tags }} labels: ${{ steps.meta-linux-amd64.outputs.labels }} - name: Docker meta for linux arm64 id: meta-linux-arm64 uses: docker/metadata-action@v4 with: flavor: | latest=false suffix=linux-arm64 images: | appleboy/gorush ghcr.io/appleboy/gorush tags: | type=raw,value=,enable={{is_default_branch}} type=semver,event=tag,pattern={{version}},suffix=-linux-arm64 type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-arm64 type=semver,event=tag,pattern={{major}},suffix=-linux-arm64 - name: Build and push linux arm64 uses: docker/build-push-action@v3 with: context: . file: docker/Dockerfile.linux.arm64 platforms: linux/arm64 push: true tags: ${{ steps.meta-linux-arm64.outputs.tags }} labels: ${{ steps.meta-linux-arm64.outputs.labels }} - name: Docker meta for linux arm id: meta-linux-arm uses: docker/metadata-action@v4 with: flavor: | latest=false suffix=linux-arm images: | appleboy/gorush ghcr.io/appleboy/gorush tags: | type=raw,value=,enable={{is_default_branch}} type=semver,event=tag,pattern={{version}},suffix=-linux-arm type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-arm type=semver,event=tag,pattern={{major}},suffix=-linux-arm - name: Build and push linux arm uses: docker/build-push-action@v3 with: context: . file: docker/Dockerfile.linux.arm platforms: linux/arm push: true tags: ${{ steps.meta-linux-arm.outputs.tags }} labels: ${{ steps.meta-linux-arm.outputs.labels }}