Merge pull request #312 from oslokommune/bump-xlsx #162
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy bydelsfakta-frontend | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache | |
uses: actions/cache@v2 | |
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@v2 | |
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 |