Skip to content

Remove eslint

Remove eslint #1738

Workflow file for this run

name: Build, publish and deploy
# Run on everything. We conditionally skip deployment, but this way the build
# is only run once. Testing could be a different workflow, but then the github
# runners would need to build it twice, wasting resources.
on: [push]
env:
IMAGE_NAME: velcom-server
UID: 1004
jobs:
# Build the frontend
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '19'
- name: "Build frontend (location independent)"
run: "./scripts/build-frontend --env production"
- name: "Upload frontend artifacts (location independent)"
uses: actions/upload-artifact@v4
with:
name: frontend-artifacts
path: frontend/dist
# Build the shared backend
build-backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: "Build backend"
run: "./scripts/build-backend"
- name: "Upload backend/backend artifact"
uses: actions/upload-artifact@v4
with:
name: backend-artifacts-backend
path: backend/backend/target/backend.jar
- name: "Upload aspectjweaver artifact"
uses: actions/upload-artifact@v4
with:
name: aspectjweaver-artifact
path: backend/backend/target/dependency/aspectjweaver.jar
- name: "Upload backend/runner artifacts"
uses: actions/upload-artifact@v4
with:
name: backend-artifacts-runner
path: backend/runner/target/runner.jar
- name: Release runner
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: backend/runner/target/runner.jar
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Push location independent image to GitHub Packages.
push-docker-image:
# Ensure build job passes before pushing image.
needs: [build-frontend, build-backend]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
# SETUP
- uses: actions/checkout@v4
- name: "Download frontend artifacts"
uses: actions/download-artifact@v4
with:
name: frontend-artifacts
path: dist
- name: "Download backend artifacts"
uses: actions/download-artifact@v4
with:
pattern: backend-artifacts-*
merge-multiple: true
- name: "Download aspectjweaver artifact"
uses: actions/download-artifact@v4
with:
name: aspectjweaver-artifact
# BUILDING
- name: "Build image"
run: "./scripts/docker/build-docker --uid $UID --metrics CI"
- name: "Log into registry"
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
# MUST change all uppercase to lowercase for Docker
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Offer the image as latest
docker tag $IMAGE_NAME $IMAGE_ID:latest
docker push $IMAGE_ID:latest