Action executed by tern19 - Frontend CI/CD #1
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: Frontend CI/CD | |
run-name: Action executed by ${{ github.actor }} - Frontend CI/CD | |
on: | |
push: | |
paths: | |
- 'src/web/**' | |
branches: | |
- main | |
- github-actions | |
pull_request: | |
paths: | |
- 'src/web/**' | |
branches: | |
- main | |
jobs: | |
cd_push_to_dockerhub: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Environment setup # Set up with a specific version of Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
cache: pip | |
- name: Cache # Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: ${{ runner.os }}-pip- | |
- name: Install packages # Install dependencies | |
run: pip install docker | |
- name: Docker login | |
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build | |
run: docker build -f Dockerfile-frontend.txt . -t app-beans-frontend-github-actions | |
- name: Tags | |
run: | | |
docker tag app-beans-frontend-github-actions ${{ secrets.DOCKER_USER }}/app-beans-frontend-github-actions:${{ github.sha }} | |
docker tag app-beans-frontend-github-actions ${{ secrets.DOCKER_USER }}/app-beans-frontend-github-actions:latest | |
- name: Push | |
run: | | |
docker push ${{ secrets.DOCKER_USER }}/app-beans-frontend-github-actions:${{ github.sha }} | |
docker push ${{ secrets.DOCKER_USER }}/app-beans-frontend-github-actions:latest |