Skip to content

Commit

Permalink
fix: testing build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
levisingularity committed Dec 18, 2023
1 parent 93053e4 commit 3c1a68e
Showing 1 changed file with 72 additions and 62 deletions.
134 changes: 72 additions & 62 deletions .github/workflows/vultr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,85 +2,95 @@
name: Vultr Build

on:
workflow_dispatch:
inputs:
version:
description: "Version"
required: true

function:
type: choice
description: "Select a function to build:"
options:
- das-atomdb
- das-query-engine
push:
branches:
- fix/vultr-build-workflow
# workflow_dispatch:
# inputs:
# version:
# description: "Version"
# required: true

# function:
# type: choice
# description: "Select a function to build:"
# options:
# - das-atomdb
# - das-query-engine


jobs:
tag:
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: develop
version-tag-regex-pattern: /^v\d+\.\d+\.\d+$/
version-require-confirmation: "true"


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: Setup
run: |-
curl -sSL https://cli.openfaas.com | sudo -E sh
FUNCTION_NAME=$(echo ${{ env.FUNCTION_PATH }} | sed 's/^das-//;s/-//g')
export FUNCTION_NAME
- 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 }}-${FUNCTION_NAME} --name $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 }}-${FUNCTION_NAME}
# tag:
# 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: develop
# version-tag-regex-pattern: /^v\d+\.\d+\.\d+$/
# version-require-confirmation: "true"


# 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: Setup
# run: |-
# curl -sSL https://cli.openfaas.com | sudo -E sh
# FUNCTION_NAME=$(echo ${{ env.FUNCTION_PATH }} | sed 's/^das-//;s/-//g')
# export FUNCTION_NAME

# - 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 }}-${FUNCTION_NAME} --name $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 }}-${FUNCTION_NAME}

build-vultr-develop:
runs-on: ubuntu-latest
needs: tag
if: github.ref == 'refs/heads/develop'
# needs: tag
if: github.ref == 'refs/heads/fix/vultr-build-workflow'
environment: develop
env:
FUNCTION_PATH: "das-query-engine"
VERSION: "1.3.2"
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
- name: Install Openfaas
run: curl -sSL https://cli.openfaas.com | sudo -E sh

- name: Set function name up
run: |-
curl -sSL https://cli.openfaas.com | sudo -E sh
FUNCTION_NAME=$(echo ${{ env.FUNCTION_PATH }} | sed 's/^das-//;s/-//g')
export FUNCTION_NAME
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 }}-${FUNCTION_NAME} --name $FUNCTION_NAME --lang python3-http --handler ${{ github.event.inputs.function }}
run: |-
echo "faas-cli build --image trueagi/das:${{ env.VERSION }}-${{ env.FUNCTION_NAME }} --name ${{ env.FUNCTION_NAME }} --lang python3-http --handler ./${{ env.FUNCTION_PATH }}"
faas-cli build --image trueagi/das:${{ env.VERSION }}-${{ env.FUNCTION_NAME }} --name ${{ env.FUNCTION_NAME }} --lang python3-http --handler ./${{ env.FUNCTION_PATH }}
- name: Login to DockerHub
if: success()
Expand All @@ -90,4 +100,4 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push Image to Registry
run: docker image push trueagi/das:${{ github.event.inputs.version }}-${FUNCTION_NAME}
run: docker image push trueagi/das:${{ env.VERSION }}-${{ env.FUNCTION_NAME }}

0 comments on commit 3c1a68e

Please sign in to comment.