Update ci.yml #12
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: uaadresses-web CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [11.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- run: npm -v | |
- run: npm install | |
- run: sudo npm i -g standard-version | |
- run: npm install karma --save-dev | |
- run: npm install karma-jasmine karma-chrome-launcher jasmine-core --save-dev | |
- run: npm ci | |
- run: npm run build --if-present | |
- run: npm run test | |
- run: npm run lint || exit 1 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GCR | |
uses: docker/login-action@v1 | |
with: | |
registry: eu.gcr.io | |
username: _json_key | |
password: ${{ secrets.GCR_JSON_KEY }} | |
- name: Set image tag | |
id: vars | |
run: | | |
echo "image_tag=$(standard-version -m "chore(release): publish %s [ci skip]" --dry-run | grep 'release v' | awk -Frelease '{ print $2 }' | xargs)" >> $GITHUB_OUTPUT | |
echo "project_name=$(cat "package.json" | grep name | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | xargs)" >> $GITHUB_OUTPUT | |
echo "timestamp=$(date +'%s')" >> $GITHUB_OUTPUT | |
- name: Build and push images | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: . | |
file: Dockerfile | |
tags: eu.gcr.io/ehealth-162117/${{ steps.vars.outputs.project_name }}:${{ steps.vars.outputs.image_tag }} | |
- run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Deployment Bot" | |
standard-version -m "chore(release): publish %s [ci skip]" | |
git remote set-url origin https://${{ secrets.GITHUB_TOKEN }}@github.com/edenlabllc/uaddresses.web.git | |
git push --follow-tags origin master | |
continue-on-error: false |