-
-
Notifications
You must be signed in to change notification settings - Fork 4
58 lines (48 loc) · 1.42 KB
/
spiders.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Build and deploy spiders
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'crawler/**'
env:
IMAGE: aunews-scrapy
DEPLOYMENT_NAME: scrapy-deployment
defaults:
run:
shell: bash
working-directory: ./crawler
jobs:
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy Web API
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: login to dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Kubernetes set context
uses: Azure/k8s-set-context@v1
with:
method: kubeconfig
kubeconfig: ${{ secrets.LINODE_KUBE_CONFIG }}
# Build the Docker image
- name: Build Docker image
run: |-
docker build --tag ausnews/spiders:${{ github.sha }} .
docker push ausnews/spiders:${{ github.sha }}
# Set up kustomize
- name: Set up Kustomize
run: |-
curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
chmod u+x ./kustomize
# Deploy the Docker image
- name: Deploy
run: |-
./kustomize edit set image aunews-scrapy=ausnews/spiders:${{ github.sha }}
./kustomize build . | kubectl apply -f -
kubectl rollout status deployment/$DEPLOYMENT_NAME