Skip to content

README 🖊️

README 🖊️ #61

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 "No tests for now..." # 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, Controller Docker images
run: |
make build-controller TAG=${{ github.sha }}
make push-controller TAG=${{ github.sha }}
docker tag ${{ env.CONTROLLER_IMAGE_NAME }}:${{ github.sha }} ${{ env.CONTROLLER_IMAGE_NAME}}:staging
docker push ${{ env.CONTROLLER_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
docker pull ${{ env.CONTROLLER_IMAGE_NAME}}:staging
docker tag ${{ env.CONTROLLER_IMAGE_NAME}}:staging ${{ env.CONTROLLER_IMAGE_NAME}}:v${{ github.run_number }}
docker push ${{ env.CONTROLLER_IMAGE_NAME}}:v${{ github.run_number }}
docker tag ${{ env.CONTROLLER_IMAGE_NAME}}:v${{ github.run_number }} ${{ env.CONTROLLER_IMAGE_NAME}}:latest
docker push ${{ env.CONTROLLER_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