Skip to content

Githubcicheck

Githubcicheck #285

Workflow file for this run

name: product-catalog-ci
on:
push:
branches:
- main
- githubcicheck # add more feature branches if needed
pull_request:
branches:
- main
jobs:

Check failure on line 12 in .github/workflows/ci.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yaml

Invalid workflow file

You have an error in your yaml syntax on line 12
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.21.x, 1.22.x, 1.23.x] # test against multiple Go versions
name: Go ${{ matrix.go-version }} CI
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go-version}}
- name: Build
run: |
cd src/product-catalog
go mod download
go build -o product-catalog-service main.go
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
steps:
- name: checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{matrix.go-version}}
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.54.2
run:
go install github.com/golangci/golangci-lint/cmd/[email protected]
export PATH=$PATH:$(go env GOPATH)/bin
golangci-lint run
working-directory: src/product-catalog
docker:
runs-on: ubuntu-latest
- name: Install dependencies
run: go mod tidy
working-directory: src/product-catalog
- name: Build
run: go build ./...
working-directory: src/product-catalog
- name: Run tests
run: go test -v ./...
working-directory: src/product-catalog
docker:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Docker
uses: docker/setup-buildx-action@v3
- name: Login to Docker
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Docker Build & Push
uses: docker/build-push-action@v6
with:
context: src/product-catalog
file: src/product-catalog/Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/product-catalog-service:${{ github.run_id }}
updatek8:
runs-on: ubuntu-latest
needs: docker
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update tag in Kubernetes deployment manifest
run: |
sed -i 's|image: .*|image: '"${{ secrets.DOCKER_USERNAME }}"'/product-catalog-service:'"${{ github.run_id }}"'|' kubernetes/productcatalog/deploy.yaml
- name: Commit and push changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "shahipranav"
git add kubernetes/productcatalog/deploy.yaml
git commit -m "[CI]: update product catalog image tag"
git push
m