From 9f5ca53c3561b99f770b9a3ee87a53c48ddb7b3a Mon Sep 17 00:00:00 2001 From: Luka Savkov Date: Fri, 13 Sep 2024 17:52:56 +0200 Subject: [PATCH] Set up GitHub Actions for CI --- .github/workflows/push.yml | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..57b404a --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,50 @@ +name: Go CI + +on: + push: + branches: + - main + +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: ../starometry/Dockerfile + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/starometry:latest