-
Notifications
You must be signed in to change notification settings - Fork 1
114 lines (93 loc) · 3.5 KB
/
vultr-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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
name: Vultr Build
on:
workflow_dispatch:
inputs:
version:
description: "Version"
required: true
changelog:
description: "Version changelog"
required: true
type: string
function:
type: choice
description: "Select a function to build:"
options:
- das-atomdb
- das-query-engine
jobs:
testing:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set dotenv
run: cp .env.example .env
- name: Run Unit & Integration Tests
run: make unit-tests unit-tests-coverage integration-tests
tag:
needs: testing
uses: singnet/das-scripts-pipeline/.github/workflows/action.yml@master
with:
version: ${{ github.event.inputs.version }}
version-strategy: bump-version-from-variable-value
job-image-namespace: trueagi
job-image-version-semver: semantic-versioning
main-branch: master
version-tag-regex-pattern: /^v\d+\.\d+\.\d+$/
version-require-confirmation: "true"
changelog: ${{ inputs.changelog }}
secrets: inherit
build-vultr-production:
runs-on: ubuntu-latest
needs: tag
environment: production
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Openfaas
run: curl -sSL https://cli.openfaas.com | sudo -E sh
- name: Set function name up
run: |-
FUNCTION_NAME=$(echo ${{ github.event.inputs.function }} | sed 's/^das-//;s/-//g')
echo "FUNCTION_NAME=$FUNCTION_NAME" >> $GITHUB_ENV
- name: Pull template
run: faas-cli template pull https://github.com/singnet/das-openfaas-templates
- name: Run shrinkwrap build
run: faas-cli build --image trueagi/das:${{ github.event.inputs.version }}-${{ env.FUNCTION_NAME }} --name ${{ env.FUNCTION_NAME }} --lang python3-http --handler ./${{ github.event.inputs.function }}
- name: Login to DockerHub
if: success()
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Image to Registry
run: docker image push trueagi/das:${{ github.event.inputs.version }}-${{ env.FUNCTION_NAME }}
build-vultr-develop:
runs-on: ubuntu-latest
needs: tag
if: github.ref == 'refs/heads/develop'
environment: develop
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Openfaas
run: curl -sSL https://cli.openfaas.com | sudo -E sh
- name: Set function name up
run: |-
FUNCTION_NAME=$(echo ${{ github.event.inputs.function }} | sed 's/^das-//;s/-//g')
echo "FUNCTION_NAME=$FUNCTION_NAME" >> $GITHUB_ENV
- name: Pull template
run: faas-cli template pull https://github.com/singnet/das-openfaas-templates
- name: Run shrinkwrap build
run: faas-cli build --image trueagi/das:${{ github.event.inputs.version }}-${{ env.FUNCTION_NAME }} --name ${{ env.FUNCTION_NAME }} --lang python3-http --handler ./${{ github.event.inputs.function }}
- name: Login to DockerHub
if: success()
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Image to Registry
run: docker image push trueagi/das:${{ github.event.inputs.version }}-${{ env.FUNCTION_NAME }}