From b3cc9b634730dfa691af7938ecd0ce41aec42ee9 Mon Sep 17 00:00:00 2001 From: akbRRksh <34182273+akbRRksh@users.noreply.github.com> Date: Sat, 25 Jan 2025 19:40:54 +0700 Subject: [PATCH] Update build.yml --- .github/workflows/build.yml | 103 ++---------------------------------- 1 file changed, 4 insertions(+), 99 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c0604208..f727d352 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -177,7 +177,7 @@ jobs: - name: Set Time Variable run: | - echo "BUILDTIME=$(date)" >> $GITHUB_ENV + echo "BUILDTIME=$(TZ=Asia/Jakarta date)" >> $GITHUB_ENV echo "CGO_ENABLED=0" >> $GITHUB_ENV echo "BUILDTAG=-extldflags --static" >> $GITHUB_ENV echo "GOTOOLCHAIN=local" >> $GITHUB_ENV @@ -201,7 +201,7 @@ jobs: run: | go test ./... echo "---test with_gvisor---" - go test ./... -tags with_low_memory,with_gvisor -count=1 + go test ./... -tags "with_gvisor" -count=1 - name: Update CA run: | @@ -218,7 +218,7 @@ jobs: GOMIPS: ${{matrix.jobs.gomips}} run: | go env - go build -v -tags with_low_memory,with_gvisor -trimpath -ldflags "${BUILDTAG} -X 'github.com/metacubex/mihomo/constant.Version=${VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -w -s -buildid=" + go build -v -tags "with_gvisor,with_low_memory" -trimpath -ldflags "${BUILDTAG} -X 'github.com/metacubex/mihomo/constant.Version=${VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -w -s -buildid=" if [ "${{matrix.jobs.goos}}" = "windows" ]; then cp mihomo.exe mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}.exe zip -r mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.zip mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}.exe @@ -330,7 +330,7 @@ jobs: deleteOnlyFromDrafts: false - name: Set Env run: | - echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV + echo "BUILDTIME=$(TZ=Asia/Jakarta date)" >> $GITHUB_ENV shell: bash - name: Tag Repo @@ -419,98 +419,3 @@ jobs: tag_name: ${{ github.event.inputs.version }} files: bin/* body_path: release.md - - Docker: - if: ${{ !startsWith(github.event_name, 'pull_request') }} - permissions: write-all - needs: [build] - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/download-artifact@v4 - with: - path: bin/ - merge-multiple: true - - - name: Display structure of downloaded files - run: ls -R - working-directory: bin - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Setup Docker buildx - uses: docker/setup-buildx-action@v3 - with: - version: latest - - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata - if: ${{ github.event_name != 'workflow_dispatch' }} - id: meta_alpha - uses: docker/metadata-action@v5 - with: - images: '${{ env.REGISTRY }}/${{ github.repository }}' - - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata - if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }} - id: meta_release - uses: docker/metadata-action@v5 - with: - images: '${{ env.REGISTRY }}/${{ github.repository }}' - tags: | - ${{ github.event.inputs.version }} - flavor: | - latest=true - labels: org.opencontainers.image.version=${{ github.event.inputs.version }} - - - name: Show files - run: | - ls . - ls bin/ - - - name: login to docker REGISTRY - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_TOKEN }} - - # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - - name: Build and push Docker image - if: ${{ github.event_name != 'workflow_dispatch' }} - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - push: ${{ github.event_name != 'pull_request' }} - platforms: | - linux/386 - linux/amd64 - linux/arm64 - linux/arm/v7 - tags: ${{ steps.meta_alpha.outputs.tags }} - labels: ${{ steps.meta_alpha.outputs.labels }} - - - name: Build and push Docker image - if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }} - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - push: ${{ github.event_name != 'pull_request' }} - platforms: | - linux/386 - linux/amd64 - linux/arm64 - linux/arm/v7 - tags: ${{ steps.meta_release.outputs.tags }} - labels: ${{ steps.meta_release.outputs.labels }} \ No newline at end of file