-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (36 loc) · 1.17 KB
/
publish-website.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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