Skip to content

Vultr Build

Vultr Build #26

Workflow file for this run

---
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 }}