Setup data sync module #2
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
name: Test Build and Publish Docker image | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
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: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Create .env file | |
run: echo "${{ secrets.ENV }}" | base64 -d > .env | |
- name: Build and tag Docker image | |
run: | | |
docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/stockdog:pr-${{ github.event.number }} . | |
- 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 |