Skip to content

Commit

Permalink
ci(backend): setup github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mael-app committed Jan 16, 2025
1 parent d6ba767 commit 28003f0
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Pipeline

on:
push:
branches:
- main
- dev-production

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

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

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

- name: Build and push Docker image with latest tag
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
${{ secrets.REGISTRY_URL }}/tekbetter/tekbetter-server:latest
${{ secrets.REGISTRY_URL }}/tekbetter/tekbetter-server:${{ github.sha }}
${{ secrets.REGISTRY_URL }}/tekbetter/tekbetter-server:$(date +'%Y%m%d')
- name: Build and push Docker image with dev tag
if: github.ref == 'refs/heads/dev-production'
uses: docker/build-push-action@v4
with:
context: .
push: true
ttags: |
${{ secrets.REGISTRY_URL }}/tekbetter/tekbetter-server:development
${{ secrets.REGISTRY_URL }}/tekbetter/tekbetter-server:${{ github.sha }}
${{ secrets.REGISTRY_URL }}/tekbetter/tekbetter-server:$(date +'%Y%m%d')
- name: Logout from Docker Hub
run: docker logout ${{ secrets.REGISTRY_URL }}

0 comments on commit 28003f0

Please sign in to comment.