Skip to content

Commit

Permalink
pre-realease4
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegGsk committed Sep 28, 2024
1 parent 1bc1efc commit 9405720
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 64 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build-and-push-github-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
branches:
- master
- dev
- feature/convert_ci-cd_to_the_prod

env:
REGISTRY: ghcr.io
Expand All @@ -32,7 +31,7 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image for Production
if: github.ref == 'refs/heads/feature/convert_ci-cd_to_the_prod'
if: github.ref == 'refs/heads/feature/master'
uses: docker/build-push-action@v5
with:
context: .
Expand Down
113 changes: 56 additions & 57 deletions .github/workflows/prod_deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Production deploy

on:
workflow_run:
workflows: [pytest, Build and push Docker image]
types: completed
branches: feature/convert_ci-cd_to_the_prod
push:
branches:
- master

env:
REGISTRY: ghcr.io
Expand All @@ -16,63 +15,63 @@ defaults:
working-directory: .

jobs:
# pytest:
# runs-on: ubuntu-latest
# name: pytest
# steps:
# - name: Install Python
# uses: actions/setup-python@v4
# with:
# python-version: 3.11

# - name: Install Poetry
# uses: snok/install-poetry@v1
# with:
# poetry-version: 1.5.0

# - name: Check out the repo
# uses: actions/checkout@v4

# - name: Install dependencies
# run: |
# poetry install
# - name: pytest
# run: |
# poetry run pytest
# working-directory: adaptive_hockey_federation
# build_and_push:
# needs: pytest
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v3

# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

# - name: Extract metadata for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# - name: Build and push Docker image for Production
# uses: docker/build-push-action@v5
# with:
# context: .
# file: infra/prod/prod.Dockerfile
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
pytest:
runs-on: ubuntu-latest
name: pytest
steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install Poetry
uses: snok/install-poetry@v1
with:
poetry-version: 1.5.0

- name: Check out the repo
uses: actions/checkout@v4

- name: Install dependencies
run: |
poetry install
- name: pytest
run: |
poetry run pytest
working-directory: adaptive_hockey_federation
build_and_push:
needs: pytest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image for Production
uses: docker/build-push-action@v5
with:
context: .
file: infra/prod/prod.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

deploy:
name: Deploy changes on server
runs-on: ubuntu-latest
# needs: [pytest, build_and_push]
needs: [pytest, build_and_push]
environment:
name: prod_deploy
steps:
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: CI

# on: [pull_request]
on:
push:
branches:
- feature/convert_ci-cd_to_the_prod
on: [pull_request]

jobs:
pytest:
Expand Down

0 comments on commit 9405720

Please sign in to comment.