-
Notifications
You must be signed in to change notification settings - Fork 0
30 lines (30 loc) · 1.18 KB
/
build.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
name: build
on:
push:
paths-ignore:
- README.md
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build Docker Image
run: |
docker build -t ghcr.io/aybaze/aybot .
- name: Push Docker Image
run: |
export IMAGE=ghcr.io/aybaze/aybot
export TAG=`expr substr $GITHUB_SHA 1 8`
docker tag ghcr.io/aybaze/aybot ghcr.io/aybaze/aybot:$TAG
echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker tag $IMAGE $IMAGE:$TAG
docker push $IMAGE:$TAG
docker push $IMAGE
if: github.ref == 'refs/heads/master'
- name: Deploy Kubernetes
run: |
export TAG=`expr substr $GITHUB_SHA 1 8`
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl
mkdir -p ~/.kube && echo ${{ secrets.KUBECONFIG_BASE64 }} | base64 -d > ~/.kube/config
envsubst < kubernetes/aybot.yaml | kubectl apply -f -
if: github.ref == 'refs/heads/master'