-
Notifications
You must be signed in to change notification settings - Fork 2
/
ops.yml
63 lines (63 loc) · 2.42 KB
/
ops.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
59
60
61
62
63
version: "1"
pipelines:
- name: sample-expressjs-pipeline-do-k8s-cdktf:0.2.5
description: Build and Publish an image in a DigitalOcean Container Registry
env:
static:
- DEBIAN_FRONTEND=noninteractive
- STACK_TYPE=do-k8s-cdktf
- ORG=cto-ai
- GH_ORG=workflows-sh
- REPO=sample-expressjs-do-k8s-cdktf
- BIN_LOCATION=/tmp/tools
secrets:
- GITHUB_TOKEN
- DO_TOKEN
events:
- "github:workflows-sh/sample-expressjs-do-k8s-cdktf:pull_request.opened"
- "github:workflows-sh/sample-expressjs-do-k8s-cdktf:pull_request.synchronize"
- "github:workflows-sh/sample-expressjs-do-k8s-cdktf:pull_request.merged"
jobs:
- name: sample-expressjs-build-do-k8s-cdktf
description: Build step for sample-expressjs-do-k8s-cdktf
packages:
- git
- unzip
- wget
- tar
steps:
- mkdir -p $BIN_LOCATION
- export PATH=$PATH:$BIN_LOCATION
- ls -asl $BIN_LOCATION
- DOCTL_DL_URL='https://github.com/digitalocean/doctl/releases/download/v1.79.0/doctl-1.79.0-linux-amd64.tar.gz' # Update to latest doctl binary here by providing URL
- wget $DOCTL_DL_URL -O doctl.tar.gz
- tar xf doctl.tar.gz -C $BIN_LOCATION
- doctl version
- git version
- git clone https://oauth2:[email protected]/$GH_ORG/$REPO
- cd $REPO && ls -asl
- git fetch -a && git checkout "${REF}"
- doctl auth init -t $DO_TOKEN
- doctl registry login
- CLEAN_REF=$(echo "${REF}" | sed 's/[^a-zA-Z0-9]/-/g' )
- docker build -f Dockerfile -t one-img-to-rule-them-all:latest .
- docker tag one-img-to-rule-them-all:latest registry.digitalocean.com/$ORG/$REPO:$CLEAN_REF
- docker push registry.digitalocean.com/$ORG/$REPO:$CLEAN_REF
services:
- name: sample-expressjs-service-do-k8s-cdktf:0.1.6
description: Preview of image built by the pipeline
run: node /ops/index.js
port: [ '8080:8080' ]
sdk: off
domain: ""
env:
static:
- PORT=8080
events:
- "github:workflows-sh/sample-expressjs-do-k8s-cdktf:pull_request.opened"
- "github:workflows-sh/sample-expressjs-do-k8s-cdktf:pull_request.synchronize"
- "github:workflows-sh/sample-expressjs-do-k8s-cdktf:pull_request.merged"
trigger:
- build
- publish
- start