From cc31a100d2a28d3172a9c9cc0e71cb8595d8d473 Mon Sep 17 00:00:00 2001 From: Kalin Daskalov Date: Tue, 10 Oct 2023 16:26:19 +0300 Subject: [PATCH] add CI file --- .github/workflow/main.yml | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflow/main.yml 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 }}