chore: changed i onto ci when installing deps #3
Workflow file for this run
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Node.js CI | |
on: | |
push: | |
branches: [ "main", "actions_init" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
node: [18.x] | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: setup-node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: install dependencies | |
run: npm ci | |
- name: check build errors | |
run: npm run build | |
- name: check test if exsists | |
run: npm test --if-present | |
push_to_registry: | |
name: login, build and push docker image to docker hub | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: create tag | |
run: echo "CURRENT_DATE=$(date +%s)" | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./Dockerfile | |
context: . | |
push: true | |
tags: aexol-shop-backend:${{ env.GITHUB_SHA_SHORT }}-${CURRENT_DATE} | |