name: CI on: [push, pull_request] env: BINARY_Name: "min_report" COMMIT_ID: "${{ github.sha }}" PR_PROMPT: "::warning:: Build artifact will not be uploaded due to the workflow is trigged by pull request." LD_FLAGS: "-w -s" GOPROXY: "https://goproxy.cn,direct" jobs: build: name: Build binary CI runs-on: ubuntu-latest container: image: ghcr.io/catthehacker/ubuntu:act-latest # 持久化工具目录 steps: - name: Checkout uses: https://gh.huoxue.store/actions/checkout@v3 with: fetch-depth: 0 - name: setup go wget https://studygolang.com/dl/golang/go1.21.3.linux-amd64.tar.gz tar -xzf ./go1.21.3.linux-amd64.tar.gz -C /usr/local echo 'export GOROOT=/usr/local/go' >> $GITHUB_ENV ln -s /usr/local/go/bin/go /usr/bin/go wget https://huoxue.link:12300/api/packages/huoxue1/generic/goreleaser/amd64_latest/goreleaser.tar.gz tar -xzvf ./goreleaser.tar.gz -C /usr/local rm ./go1.21.3.linux-amd64.tar.gz rm ./goreleaser.tar.gz ln -s /usr/local/goreleaser /usr/bin/goreleaser - name: Fetch all tags run: git fetch --force --tags - name: Check snapshot if: "!startsWith(github.ref, 'refs/tags/')" id: snapshot run: echo '::set-output name=ARG::--snapshot' - name: push release if: "startsWith(github.ref, 'refs/tags/')" run: | export GITEA_TOKEN=${{ secrets.TOKEN }} goreleaser release --timeout 5h30m --clean env: GITEA_TOKEN: ${{ secrets.TOKEN }} - name: Run GoReleaser if: "!startsWith(github.ref, 'refs/tags/')" run: | export GITEA_TOKEN=${{ secrets.TOKEN }} goreleaser build --snapshot --timeout 5h30m --clean env: GITEA_TOKEN: ${{ secrets.TOKEN }} - name: Set up QEMU id: qemu uses: https://gh.huoxue.store/docker/setup-qemu-action@v2 - name: Set up Docker Buildx id: buildx uses: https://gh.huoxue.store/docker/setup-buildx-action@v2 - name: Docker meta id: meta uses: https://gh.huoxue.store/docker/metadata-action@v4 with: images: huoxue.link:12300/huoxue1/min_report tags: | type=raw,value=latest type=ref,event=tag - name: Docker Login if: github.event_name != 'pull_request' uses: https://gh.huoxue.store/docker/login-action@v2 with: registry: huoxue.link:12300 username: ${{ secrets.USERNAME }} password: ${{ secrets.PASSWORD }} - name: Build and push id: docker_build uses: https://gh.huoxue.store/docker/build-push-action@v3 with: context: . push: ${{ github.event_name != 'pull_request' }} platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} cache-from: type=gha cache-to: type=gha,mode=max shm-size: 2g ulimit: core=0:0 - name: Meta-cnn id: meta-cnn uses: https://gh.huoxue.store/docker/metadata-action@v4 with: images: huoxue.link:12300/huoxue1/cnn tags: | type=raw,value=latest type=ref,event=tag - name: Build and push cnn id: docker_build_cnn uses: https://gh.huoxue.store/docker/build-push-action@v3 with: context: . push: ${{ github.event_name != 'pull_request' }} file: ./Dockerfile.cnn platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} cache-from: type=gha cache-to: type=gha,mode=max shm-size: 2g ulimit: core=0:0