Skip to content

Fixed eligibility checklist #507

Fixed eligibility checklist

Fixed eligibility checklist #507

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI to Docker Hub
# Controls when the action will run. Triggers the workflow on push or pull request events
on:
push:
branches: [master, dev]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# 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
- uses: actions/checkout@v2
- name: Set outputs
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 16
- name: Install Dependencies and Compile Assets
run: |
npm install
npm run prod
- name: Build Docker Image
run: docker-compose build --no-cache
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker Hub (Master)
if: contains(github.ref, 'master')
run: |
docker tag vatusa/www vatusa/www:${{ steps.vars.outputs.sha_short }}
docker push vatusa/www:${{ steps.vars.outputs.sha_short }}
- name: Push to Docker Hub (Dev)
if: contains(github.ref, 'dev')
run: |
docker tag vatusa/www vatusa/www:dev
docker push vatusa/www:dev
- name: Install kubectl
uses: azure/setup-kubectl@v3
with:
version: 'v1.21.2'
- name: Create kubeconfig
run: |
mkdir ~/.kube
cat << EOF > ~/.kube/config
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: ${{ secrets.KUBECONFIG_CLUSTER_CERT_AUTH_DATA }}
server: ${{ secrets.KUBECONFIG_CLUSTER_SERVER }}
name: ${{ secrets.KUBECONFIG_CLUSTER_NAME }}
contexts:
- context:
cluster: ${{ secrets.KUBECONFIG_CLUSTER_NAME }}
user: ${{ secrets.KUBECONFIG_CLUSTER_NAME }}-admin
name: ${{ secrets.KUBECONFIG_CLUSTER_NAME }}
current-context: ${{ secrets.KUBECONFIG_CLUSTER_NAME }}
kind: Config
preferences: {}
users:
- name: ${{ secrets.KUBECONFIG_CLUSTER_NAME }}-admin
user:
token: ${{ secrets.KUBECONFIG_CLUSTER_TOKEN }}
EOF
- name: Deploy to Kubernetes Cluster - Update Deployment
if: contains(github.ref, 'master')
run: |
kubectl set image deployment/www *=vatusa/www:${{ steps.vars.outputs.sha_short }} -n web
- name: Deploy to Kubernetes Cluster - Update Cron Job
if: contains(github.ref, 'master')
run: |
kubectl set image cronjob/www-cron *=vatusa/www:${{ steps.vars.outputs.sha_short }} -n web
- name: Deploy to Kubernetes Cluster - Update Queue Worker
if: contains(github.ref, 'master')
run: |
kubectl set image deployment/www-queue *=vatusa/www:${{ steps.vars.outputs.sha_short }} -n web