Skip to content

Commit

Permalink
Added ci/cd pipelines (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDyakonov authored Nov 20, 2024
1 parent 55b98b4 commit d1e8b34
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/cd-production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: cd-prod


on:
workflow_dispatch:
inputs:
tag_name:
description: Write tag for deploy
required: true

jobs:
ci-tests:
uses: ./.github/workflows/ci-tests.yaml

push_to_registry:
name: Push Docker image to Docker Hub
needs: [ci-tests]
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != '')
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:latest
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:${{ github.event.inputs.tag_name }}
- name: Trigger watchtower to update container(s)
shell: bash
run: |
curl -H "Authorization: Bearer ${{ secrets.WATCHTOWER_HTTP_API_TOKEN }}" ${{ secrets.WATCHTOWER_UPDATE_ENDPOINT }}
18 changes: 18 additions & 0 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: ci-build

on:
workflow_call: {}
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build docker image
run: docker buildx build --load --progress=plain .
12 changes: 12 additions & 0 deletions .github/workflows/ci-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: ci-tests

on: [workflow_call]

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Skip stage
run: echo "Stages skipped."

0 comments on commit d1e8b34

Please sign in to comment.