Skip to content

Production deploy

Production deploy #113

Workflow file for this run

name: 'Production deploy'
permissions:
contents: write
packages: write
on:
workflow_dispatch:
inputs:
message:
description: 'Reason for the production deploy'
required: true
default: 'Scheduled production deploy'
jobs:
discord-notify-start:
runs-on: ubuntu-latest
steps:
- name: Discord notification for start
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: 'Maestro production deploy started: "${{ inputs.message }}" by ${{ github.actor }}'
tag-core:
runs-on: ubuntu-latest
needs: discord-notify-start
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: kernelci/kernelci-core
ref: main
fetch-depth: 0
- name: Tag repositories
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
TAG="production-$(date +'%Y%m%d%H%M%S')"
echo "Tagging repositories with tag: $TAG"
git tag $TAG
git push origin $TAG
echo "Tagged kernelci/kernelci-core with $TAG"
# Add similar tagging commands for other repositories as needed
tag-pipeline:
runs-on: ubuntu-latest
needs: discord-notify-start
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: kernelci/kernelci-pipeline
ref: main
fetch-depth: 0
token: ${{ secrets.GHPAT }}
persist-credentials: false
- name: Tag repositories
env:
TOKEN: ${{ secrets.GHPAT }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
TAG="production-$(date +'%Y%m%d%H%M%S')"
echo "Tagging repositories with tag: $TAG"
git tag $TAG
git remote set-url origin https://x-access-token:${TOKEN}@github.com/kernelci/kernelci-pipeline.git
git push origin $TAG
echo "Tagged kernelci/kernelci-pipeline with $TAG"
# Add similar tagging commands for other repositories as needed
tag-api:
runs-on: ubuntu-latest
needs: discord-notify-start
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: kernelci/kernelci-api
ref: main
fetch-depth: 0
token: ${{ secrets.GHPAT }}
persist-credentials: false
- name: Tag repositories
env:
TOKEN: ${{ secrets.GHPAT }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
TAG="production-$(date +'%Y%m%d%H%M%S')"
echo "Tagging repositories with tag: $TAG"
git tag $TAG
git remote set-url origin https://x-access-token:${TOKEN}@github.com/kernelci/kernelci-api.git
git push origin $TAG
echo "Tagged kernelci/kernelci-api with $TAG"
# Add similar tagging commands for other repositories as needed
call-docker-build:
uses: ./.github/workflows/docker_images.yml
needs: [tag-core, tag-pipeline, tag-api]
secrets: inherit
with:
GIT_OWNER: 'kernelci'
GIT_BRANCH: 'main'
deploy-k8s-production:
runs-on: ubuntu-latest
needs: call-docker-build
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: kernelci/kernelci-deploy
ref: main
- name: Set up kubectl
uses: azure/k8s-set-context@v4
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBECONFIG }}
- name: Deploy to production
run: |
cd kubernetes
./api-production-update.sh workflow
- name: Discord notification for end
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: 'Maestro production deploy completed.'
discord-notify-failure:
runs-on: ubuntu-latest
if: failure()
needs: [discord-notify-start, call-docker-build, deploy-k8s-production]
steps:
- name: Notify failure to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: '❌ Maestro production deploy failed.'