Merge pull request #63 from Vercin-G/dev #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: SERVER_ADR_PUSH | |
# Controls when the workflow will run | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/server_adr_push.yml" | |
- "server/**" | |
- "Dockerfile" | |
- "package.json" | |
- "config/server/**" | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# deployment | |
server_deployment: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout the Repo | |
uses: actions/checkout@v3 | |
- name: Build Server Image | |
run: docker build --file ./Dockerfile --tag registry.digitalocean.com/s6containers/adr_server:$(echo $GITHUB_SHA | head -c7) . | |
- name: Instal doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
- name: Log in to DO Container Registry | |
run: doctl registry login --expiry-seconds 600 | |
- name: Push image to DO Container Registry | |
run: docker push registry.digitalocean.com/s6containers/adr_server:$(echo $GITHUB_SHA | head -c7) | |
- name: Update Deployment File | |
run: TAG=$(echo $GITHUB_SHA | head -c7) && sed -i 's|<IMAGE>|registry.digitalocean.com/s6containers/adr_server:'${TAG}'|' $GITHUB_WORKSPACE/config/server/deployment.yml | |
- name: Save DO Kubeconfig with short-lived credentials | |
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 cav-kube | |
- name: Deploy to DO Cluster | |
run: kubectl apply -f $GITHUB_WORKSPACE/config/server/deployment.yml | |
- name: Verify Deployment | |
run: kubectl rollout status deployment/adr-server -n 7cav |