-
Notifications
You must be signed in to change notification settings - Fork 58
76 lines (76 loc) · 2.86 KB
/
publish-tag.yaml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
jobs:
publish-tag-container:
if: "github.repository_owner == 'change-metrics'"
name: publish-tag-container
runs-on: ubuntu-latest
steps:
- uses: "actions/[email protected]"
- uses: "cachix/install-nix-action@v20"
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: "cachix/cachix-action@v12"
with:
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
name: change-metrics
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Set write permission for data directory
run: "chmod o+w data"
- name: Create a config.yaml file
run: |
cat > etc/config.yaml << EOF
---
workspaces:
- name: monocle
crawlers:
- name: github-tekton
update_since: "2020-01-01"
provider:
github_organization: tekton
EOF
- name: Create a secret.yaml file
run: |
cat > .secrets << EOF
CRAWLERS_API_KEY=secret
GITHUB_TOKEN=123
EOF
- name: Build monocle-exe container
run: "nix build .#containerMonocle; docker load < ./result"
- name: Build docker image
run: docker build -t quay.io/change-metrics/monocle:latest .
- name: Set Monocle compose image to latest
run: "echo \"COMPOSE_MONOCLE_VERSION=latest\" > .env"
- name: Start Monocle compose
run: docker-compose up -d
- name: Wait for services to start
run: sleep 45
- name: Display docker-compose ps
run: docker-compose ps
- name: Display docker-compose logs
run: docker-compose logs
- name: Check services are running
run: "test -z \"$(sudo docker-compose ps -a | grep Exit)\""
- name: Check api service through nginx
run: "curl -s --fail -H 'Content-type: application/json' http://localhost:8080/api/2/get_workspaces -d '{}' | grep 'workspaces'"
- name: Check web service to fetch web app
run: "curl -s http://localhost:8080/index.html | grep 'window.document.title'"
- id: tagName
name: Discover GIT tag
uses: "olegtarasov/[email protected]"
- name: Display tag name
run: "echo \"Discovered tag: $GIT_TAG_NAME\""
- name: Tag the container image
run: "docker tag quay.io/change-metrics/monocle:latest quay.io/change-metrics/monocle:$GIT_TAG_NAME"
- name: Login on quay.io
run: "docker login -u \"${{ secrets.QUAYIO_USERNAME }}\" -p \"${{ secrets.QUAYIO_PASSWORD }}\" quay.io"
- name: Publish image to quay.io
run: "docker push quay.io/change-metrics/monocle:$GIT_TAG_NAME"
name: Publish Tag Container
on:
push:
tags:
- "*"