refactor : pipelines #6
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: readly frontend pipeline | |
on: | |
push: | |
branches: | |
- ci/pipeline | |
- master | |
paths: | |
- frontend/** | |
- Docker/frontend/** | |
- 'docker-compose.yml' | |
- .github/workflows/*-frontend.yml | |
jobs: | |
build-image: | |
name: build image | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: extract project version | |
id: extract_version | |
run: | | |
cd frontend | |
sudo apt-get install -y jq | |
echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT | |
- name: login to docker hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: build and push to docker hub | |
uses: docker/build-push-action@v5 | |
with: | |
context: frontend | |
file: Docker/frontend/Dockerfile | |
push: true | |
platforms: linux/amd64 | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/readly-frontend:${{ steps.extract_version.outputs.VERSION }}, ${{ secrets.DOCKERHUB_USERNAME }}/readly-frontend:latest |