Skip to content

Add instructions to connect VS Code to VMs #139

Add instructions to connect VS Code to VMs

Add instructions to connect VS Code to VMs #139

name: Build and publish the CrownLabs website
on: [push]
jobs:
build-and-publish:
name: Build and publish the CrownLabs website
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
submodules: 'true'
- name: Get current time
uses: 1466587594/get-current-time@v2
id: time
with:
format: YYYYMMDD-HHmmss
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set the Docker tags
id: tags
run: |
TIME=${{ steps.time.outputs.formattedTime }}
REPOSITORY=crownlabs/website
PRODUCTION_TAG=stable-${TIME}
DEVELOPMENT_TAG=development-${TIME}
echo ::set-output name=repository::${REPOSITORY}
echo ::set-output name=production_tag::${PRODUCTION_TAG}
echo ::set-output name=development_tag::${DEVELOPMENT_TAG}
[[ ${{ github.ref }} == 'refs/heads/master' ]] && \
echo ::set-output name=all_images::${REPOSITORY}:${PRODUCTION_TAG},${REPOSITORY}:${DEVELOPMENT_TAG} || \
echo ::set-output name=all_images::${REPOSITORY}:${DEVELOPMENT_TAG}
- name: Build and Push the CrownSite image
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: |
${{ steps.tags.outputs.repository }}:latest
${{ steps.tags.outputs.repository }}:${{ github.sha }}
${{ steps.tags.outputs.all_images }}
- name: Load the production configuration
run: |
cat deployment/production.env >> $GITHUB_ENV
- name: Generate the production manifest
uses: danielr1996/[email protected]
with:
input: deployment/manifest.yaml.tmpl
output: deployment/production.yaml
env:
IMAGE_TAG: ${{ steps.tags.outputs.production_tag }}
- name: Load the deployment configuration
run: |
cat deployment/development.env >> $GITHUB_ENV
- name: Generate the development manifest
uses: danielr1996/[email protected]
with:
input: deployment/manifest.yaml.tmpl
output: deployment/development.yaml
env:
IMAGE_TAG: ${{ steps.tags.outputs.development_tag }}
- name: Deploy the production website
uses: giorio94/[email protected]
with:
kubeconfig: ${{ secrets.KUBECONFIG }}
args: apply -f deployment/production.yaml
if: github.ref == 'refs/heads/master'
- name: Deploy the production website (DRY-RUN)
uses: giorio94/[email protected]
with:
kubeconfig: ${{ secrets.KUBECONFIG }}
args: apply -f deployment/production.yaml --dry-run=server
if: github.ref != 'refs/heads/master'
- name: Deploy the development website
uses: giorio94/[email protected]
with:
kubeconfig: ${{ secrets.KUBECONFIG }}
args: apply -f deployment/development.yaml