Skip to content

feat: adding search endpoints for games #95

feat: adding search endpoints for games

feat: adding search endpoints for games #95

Workflow file for this run

name: CI/CD
on:
pull_request:
types: [opened, edited, synchronize, reopened, ready_for_review]
branches:
- "*"
push:
branches:
- main
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PAT: ${{ secrets.DOCKER_HUB_PAT }}
DOCKER_CONTAINER: gcstatus-api
DOCKER_PORT: ${{ secrets.DOCKER_PORT }}
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
go: [1.22.0]
name: Running tests - GoLang v${{ matrix.go }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup GoLang
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Cache go.sum
uses: actions/cache@v4
id: sum-cache
with:
key: ${{ runner.os }}-sum-${{ hashFiles('go.sum') }}
path: vendor
- name: Install go dependencies
if: steps.sum-cache.outputs.cache-hit != 'true'
run: |
go mod download
go mod vendor
- name: Execute tests
run: go test ./tests/... -coverprofile=coverage.txt
- name: Execute go vet
run: go vet ./...
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
args: ./...
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload results to Codecov
if: github.event.pull_request.draft == false
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
all_required_checks_passed:
name: All required checks passed
runs-on: ubuntu-latest
needs: [tests]
if: contains(github.ref, 'refs/heads/main') != true
steps:
- name: Mark PR as ready to merge
run: exit 0
release:
name: Generate a new release
needs: [tests]
permissions: write-all
strategy:
fail-fast: true
matrix:
node: [22]
if: contains(github.ref, 'refs/heads/main')
runs-on: ubuntu-latest
outputs:
version: ${{ steps.release.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: semantic release
id: release
run: |
npm i -D @semantic-release/exec
npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: ubuntu-latest
needs: [release]
if: needs.release.outputs.version != null
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_PAT }}
- name: Create docker metadata
uses: docker/metadata-action@v3
id: meta
with:
images: ${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_CONTAINER }}
tags: |
type=semver,prefix=v,pattern={{version}},value=${{ needs.release.outputs.version }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
file: Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
deploy-prod:
name: Deploy to production environment
needs: [release, build]
uses: ./.github/workflows/deploy-production.yml
with:
container-tag: v${{ needs.release.outputs.version }}
secrets: inherit