Skip to content

Merge branch 'main' into release #6

Merge branch 'main' into release

Merge branch 'main' into release #6

Workflow file for this run

# env:
# DOCKER_REGISTRY: docker.io
# DAEMON_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/obzev0-grpc-daemon
# CONTROLLER_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/obzev0-k8s-controller
name: Docker CI/CD Pipeline
on:
push:
branches: [staging, release]
pull_request:
branches: [dev, staging, release]
env:
DOCKER_REGISTRY: docker.io
DAEMON_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/obzev0-grpc-daemon
CONTROLLER_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/obzev0-k8s-controller
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run tests
run: echo "Running tests..." # Replace with actual test command
build-and-push-staging:
needs: test
if: github.ref == 'refs/heads/staging'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Daemon Docker image
run: |
make build-daemon TAG=${{ github.sha }}
make push-daemon TAG=${{ github.sha }}
docker tag ${{ env.DAEMON_IMAGE_NAME }}:${{ github.sha }} ${{ env.DAEMON_IMAGE_NAME }}:staging
docker push ${{ env.DAEMON_IMAGE_NAME }}:staging
create-release:
if: github.ref == 'refs/heads/release'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
repository-projects: write
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Pull and tag staging image for release
run: |
docker pull ${{ env.DAEMON_IMAGE_NAME }}:staging
docker tag ${{ env.DAEMON_IMAGE_NAME }}:staging ${{ env.DAEMON_IMAGE_NAME }}:v${{ github.run_number }}
docker push ${{ env.DAEMON_IMAGE_NAME }}:v${{ github.run_number }}
docker tag ${{ env.DAEMON_IMAGE_NAME }}:v${{ github.run_number }} ${{ env.DAEMON_IMAGE_NAME }}:latest
docker push ${{ env.DAEMON_IMAGE_NAME }}:latest
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release ${{ github.run_number }}
body: ${{ github.event.head_commit.message }}
draft: false
prerelease: false