FIX (docker hub): Fix updating description #55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & push Docker image | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: {} | |
| jobs: | |
| lint-backend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23.3" | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/go/pkg/mod | |
| ~/.cache/go-build | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Install golangci-lint | |
| run: | | |
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.3 | |
| echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
| - name: Install swag for swagger generation | |
| run: go install github.com/swaggo/swag/cmd/[email protected] | |
| - name: Generate swagger docs | |
| run: | | |
| cd backend | |
| swag init -d . -g cmd/main.go -o swagger | |
| - name: Run golangci-lint | |
| run: | | |
| cd backend | |
| golangci-lint run | |
| - name: Verify go mod tidy | |
| run: | | |
| cd backend | |
| go mod tidy | |
| git diff --exit-code go.mod go.sum || (echo "go mod tidy made changes, please run 'go mod tidy' and commit the changes" && exit 1) | |
| lint-frontend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| run: | | |
| cd frontend | |
| npm ci | |
| - name: Check if prettier was run | |
| run: | | |
| cd frontend | |
| npm run format | |
| git diff --exit-code || (echo "Prettier made changes, please run 'npm run format' and commit the changes" && exit 1) | |
| - name: Check if linter was run | |
| run: | | |
| cd frontend | |
| npm run lint | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| needs: [lint-backend, lint-frontend] | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU (enables multi-arch emulation) | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64 # both chip families | |
| tags: | | |
| rostislavdugin/postgresus:latest | |
| rostislavdugin/postgresus:${{ github.sha }} | |
| - name: Update Docker Hub description | |
| uses: peter-evans/dockerhub-description@v4 | |
| continue-on-error: true | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
| repository: rostislavdugin/postgresus | |
| short-description: "Free PostgreSQL monitoring & backup solution" | |
| readme-filepath: ./README.md |