Vultr Build #99
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Vultr Build | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version" | |
required: true | |
function: | |
type: choice | |
description: "Select a function to build:" | |
default: das-query-engine | |
options: | |
- das-query-engine | |
jobs: | |
code-quality: | |
uses: ./.github/workflows/testing.yml | |
secrets: inherit | |
tag: | |
needs: code-quality | |
uses: singnet/das/.github/workflows/run-semver.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: /^\d+\.\d+\.\d+$/ | |
version-require-confirmation: "true" | |
title: New version of FaaS Gateway | |
deliverable: Tagged branch (${{ github.ref_name }}) in the repository | |
secrets: inherit | |
build-vultr-production: | |
runs-on: ubuntu-22.04 | |
needs: tag | |
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 variables | |
run: |- | |
FUNCTION_NAME=$(echo ${{ github.event.inputs.function }} | sed 's/^das-//') | |
FUNCTION_VERSION=${{ github.event.inputs.version }} | |
echo "FUNCTION_NAME=$FUNCTION_NAME" >> $GITHUB_ENV | |
echo "FUNCTION_VERSION=$FUNCTION_VERSION" >> $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/openfaas:${{ env.FUNCTION_NAME }}-${{ env.FUNCTION_VERSION }} --name ${{ env.FUNCTION_NAME }} --lang python3-http --handler ./${{ github.event.inputs.function }} --build-label fn.version=${{ env.FUNCTION_VERSION }} | |
- 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/openfaas:${{ env.FUNCTION_NAME }}-${{ env.FUNCTION_VERSION }} | |
docker image tag trueagi/openfaas:${{ env.FUNCTION_NAME }}-${{ env.FUNCTION_VERSION }} trueagi/openfaas:${{ env.FUNCTION_NAME }}-latest | |
docker image push trueagi/openfaas:${{ env.FUNCTION_NAME }}-latest |