Skip to content

ci:(workflow) add docker registry login #7

ci:(workflow) add docker registry login

ci:(workflow) add docker registry login #7

Workflow file for this run

name: CI
on:
push:
branches:
- master
jobs:
build:
name: 'Build and Push'
runs-on: 'ubuntu-latest'
strategy:
matrix:
node: [16, 18, 20]
steps:
- uses: actions/checkout@v4
- name: Setup node | ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- run: npm install
- run: npm run test
- name: Generate tag
id: generate_tag
run: |
SHA=$(echo ${GITHUB_SHA} | head -c7)
echo "sha=${SHA}" >> $GITHUB_OUTPUT
- name: Login into container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build docker image
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/masa-api:${{ steps.generate_tag.outputs.sha }} .
- name: Push image
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/masa-api:${{ steps.generate_tag.outputs.sha }}