diff --git a/.github/workflow/main.yml b/.github/workflow/main.yml new file mode 100644 index 0000000000..68fbf439ae --- /dev/null +++ b/.github/workflow/main.yml @@ -0,0 +1,55 @@ +name: CI Build and Upload + +on: + pull_request: + types: + - closed + +jobs: + build-and-upload: + runs-on: self-hosted + + steps: + - name: Check PR label + id: check_label + uses: actions/labeler@v2 + with: + action: contains + label: CI:TriggerBuild + + - name: Tag with Branch + id: image_tag + run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + + - name: Check repository + id: check_repo + run: echo "::set-output name=repo::${{ github.event.pull_request.base.repo.name }}" + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build Docker image + id: build-image + run: | + docker buildx build -t my-golang-app . + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64,linux/386 + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/go-ethereum:${{ env.BRANCH }} + build-args: | + BRANCH=${{ env.BRANCH }}