Skip to content

Merge pull request #328 from oslokommune/dependabot/npm_and_yarn/serv… #179

Merge pull request #328 from oslokommune/dependabot/npm_and_yarn/serv…

Merge pull request #328 from oslokommune/dependabot/npm_and_yarn/serv… #179

Workflow file for this run

name: Build and deploy bydelsfakta-frontend
on:
workflow_dispatch:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
~/cache
!~/cache/exclude
**/node_modules
~/.cache
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node-version }}
- name: npm install, test, and build
run: |
npm install
npm install --prefix server
npm run lint
npm run lint:style
npm run test:unit
env:
CI: true
- name: Automated version bump
uses: oslokommune/gh-action-bump-version@master
with:
tag-prefix: ""
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: npm build
run: |
npm run build
env:
CI: true
- name: Set env variable
run: |
echo "RELEASE_VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
- name: Publish docker image
uses: oslokommune/Publish-Docker-Github-Action@master
with:
name: oslokommune/bydelsfakta-frontend
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
tags: latest,${{ env.RELEASE_VERSION }}
dockerfile: Dockerfile
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
aws-region: eu-west-1
- name: Deploy to aws ecs prod
run: |
aws ecs update-service --force-new-deployment --service bydelsfakta --cluster bydelsfakta --region eu-west-1