Skip to content

Setup data sync module #5

Setup data sync module

Setup data sync module #5

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4
- name: Set up NodeJS
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn test
- name: Build Docker image
run: |
docker build -t stockdog:pr-${{ github.event.number }} .
docker save stockdog:pr-${{ github.event.number }} . > stockdog:pr-${{ github.event.number }}
- name: Save Docker image as artifact
uses: actions/upload-artifact@v4
with:
name: docker-image
path: stockdog:pr-${{ github.event.number }}
push:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Docker image from artifact
uses: actions/download-artifact@v4
with:
name: docker-image
path: stockdog:pr-${{ github.event.number }}
- name: Load Docker image
run: docker load < stockdog:pr-${{ github.event.number }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Push Docker image
run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/stockdog:pr-${{ github.event.number }}
- name: Update image metadata
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_HUB_USERNAME }}/stockdog:pr-${{ github.event.number }}
tags: |
type=sha
labels: |
org.opencontainers.image.title=StockDog App
org.opencontainers.image.description=Stock market analysis app
org.opencontainers.image.url=https://github.com/${{github.repository}}
org.opencontainers.image.revision=${{github.sha}}
org.opencontainers.image.licenses=MIT