Skip to content

feat(frontend): Create/List Leagues #95

feat(frontend): Create/List Leagues

feat(frontend): Create/List Leagues #95

Workflow file for this run

name: Build and Test & publish
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Go environment
uses: actions/[email protected]
with:
go-version-file: go.mod
# Used to specify whether caching is needed. Set to true, if you'd like to enable caching.
cache: true
# Used to specify the path to a dependency file - go.sum
cache-dependency-path: go.sum
- name: Setup dependencies
run: make setup-backend env
- name: Generate code from spec
run: make generate-backend
- name: Run go vet
run: go vet ./...
- name: Run backend tests
run: make test-backend-cov
- uses: actions/upload-artifact@v2
with:
name: backend-reports
path: reports
frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/[email protected]
with:
# File containing the version Spec of the version to use. Examples: .nvmrc, .node-version, .tool-versions.
node-version-file: web/app/.nvmrc
# Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.
cache: yarn
cache-dependency-path: web/app/yarn.lock
- name: Setup dependencies
run: make setup-frontend env
- name: Generate code from spec
run: make generate-frontend
- name: Run frontend tests
run: make test-frontend
- uses: actions/upload-artifact@v2
with:
name: frontend-reports
path: reports
docker:
runs-on: ubuntu-latest
needs:
- frontend
- backend
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- name: Build Docker image
uses: docker/[email protected]
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
sonar:
runs-on: ubuntu-latest
needs:
- publish
if: ${{ always() && (needs.publish.result == 'skipped' || needs.publish.result == 'success') }}
steps:
- uses: actions/checkout@v3
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
ref: ${{ github.ref == 'refs/heads/main' && 'main' || '' }}
- uses: actions/download-artifact@v2
with:
name: frontend-reports
path: reports
- uses: actions/download-artifact@v2
with:
name: backend-reports
path: reports
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
publish:
needs:
- docker
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
git-user-name: github-actions
git-user-email: [email protected]
fallback-version: 0.0.0
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-commit: true
version-file: web/app/package.json
git-push: false
- name: Update version field in OAPI spec file
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: mikefarah/[email protected]
with:
cmd: yq -i '.info.version = "${{ steps.changelog.outputs.version }}"' 'api/openapi.yaml'
- name: Update version field of sonar-project.properties
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: sed -i "s/sonar.projectVersion=.*/sonar.projectVersion=${{ steps.changelog.outputs.version }}/" "sonar-project.properties"
- name: Commit release
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
git config --local user.name github-actions
git config --local user.email [email protected]
git add .
git commit -m "chore(release): ${{ steps.changelog.outputs.tag }} [skip ci]"
- name: Extract metadata (tags, labels) for Docker
id: meta
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=semver,pattern={{version}},value=${{ steps.changelog.outputs.tag }}
# type=ref,event=branch
# type=ref,event=pr
- name: Build and push Docker image
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: docker/[email protected]
with:
context: .
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Push changes
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
git push origin main --follow-tags
- name: Create Release
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: false
name: ${{ steps.changelog.outputs.tag }}
tag: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
token: ${{ github.token }}