Skip to content

Publish Website

Publish Website #553

name: Publish Website
on:
push:
branches:
- main
workflow_dispatch:
repository_dispatch:
env:
IMAGE_NAME: mojojs.org
jobs:
push:
runs-on: ubuntu-latest
environment: Build
steps:
- uses: actions/checkout@v2
- uses: jberger/action-install-kubectl@master
with:
kube_config_data: ${{ secrets.KUBE_CONFIG_DATA }}
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: echo "${{ secrets.WRITE_PACKAGES_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Only runs for main, so its always latest
VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: Rollout
run: |
kubectl rollout restart deployment mojojs-org && kubectl rollout status deployment mojojs-org