diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..5957bd6 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,50 @@ +name: Go CI + +on: + push: + branches: + - master + +jobs: + go-ci: + runs-on: ubuntu-latest + + steps: + - name: Check out main repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22.3' + + - name: Update and tidy Go modules + run: go mod tidy + + - name: Install dependencies + run: go mod download + working-directory: ./ + + - name: Build + run: go build -v ./... + working-directory: ./ + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v6 + with: + context: . + file: ../gravity/Dockerfile + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/gravity:latest