Skip to content

fix: update grpcserver.go (#31) #8

fix: update grpcserver.go (#31)

fix: update grpcserver.go (#31) #8

Workflow file for this run

name: Allie Release
on:
push:
tags:
- '*'
env:
MAIN_PYTHON_VERSION: '3.12'
DOCUMENTATION_CNAME: 'laughing-guide-5m1lvq6.pages.github.io'
jobs:
binaries:
name: Create binaries for Windows and Linux
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: 'go.sum'
- name: Build binaries (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
# Build the binaries
go build -tags netgo -o dist/${{ github.event.repository.name }}-${{ github.ref_name }}
- name: Build binaries (Windows)
if: matrix.os == 'windows-latest'
run: |
# Build the binaries
go build -tags netgo -o dist/${{ github.event.repository.name }}-${{ github.ref_name }}.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-binaries
path: dist/${{ github.event.repository.name }}-*
sign-windows-binary:
name: Sign Windows binary
needs: [binaries]
runs-on:
group: ansys-network
labels: [self-hosted, Windows, signtool]
steps:
- name: Checkout the SignTool
uses: actions/checkout@v4
with:
repository: ansys-internal/signtool-ansys-apps
token: ${{ secrets.SIGNTOOL_ACCESS_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: windows-latest-binaries
path: signtool/installer
- name: List current structure
run: ls -R
- name: Sign application
working-directory: signtool
run: |
$filename = (get-ChildItem installer -recurse | where {$_.name -like "allie-flowkit-*"}).Name
$jobname = $filename -replace ".{4}$"
dotnet signclient.dll sign `
-r [email protected] `
-s '${{ secrets.SIGNTOOL_PWD }}' `
-c AppSettings.json `
-n $jobname `
-i installer/$filename
- uses: actions/upload-artifact@v4
with:
name: windows-latest-binaries-signed
path: signtool/installer/*.exe
release:
name: Create release
needs: [sign-windows-binary, binaries]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Windows binaries
uses: actions/download-artifact@v4
with:
name: windows-latest-binaries-signed
path: dist
- name: Download Linux binaries
uses: actions/download-artifact@v4
with:
name: ubuntu-latest-binaries
path: dist
- name: Release to GitHub
uses: softprops/action-gh-release@v2
with:
fail_on_unmatched_files: true
generate_release_notes: true
files: |
dist/${{ github.event.repository.name }}-**
docker:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check if tag name contains 'dev'
run: echo "is_dev_tag=$(echo ${{ github.ref_name }} | grep -q 'dev' && echo 'true' || echo 'false')" >> $GITHUB_ENV
- name: Decompose tag into components
if: env.is_dev_tag == 'false'
run: |
if [[ ${{ github.ref_name }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Split the tag into its components
IFS='.' read -ra PARTS <<< "${{ github.ref_name }}"
echo "X=${PARTS[0]}" >> $GITHUB_ENV
echo "Y=${PARTS[1]}" >> $GITHUB_ENV
echo "Z=${PARTS[2]}" >> $GITHUB_ENV
else
echo "Invalid tag format. Expected vX.Y.Z but got ${{ github.ref_name }}"
exit 1
fi
- name: Build and push Docker image
if: env.is_dev_tag == 'false'
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}:${{ env.X }} ,
ghcr.io/${{ github.repository }}:${{ env.X }}.${{ env.Y }} ,
ghcr.io/${{ github.repository }}:${{ env.X }}.${{ env.Y }}.${{ env.Z }} ,
ghcr.io/${{ github.repository }}:latest
- name: Build and push Docker image dev
if: env.is_dev_tag == 'true'
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
doc-build:
name: "Build project documentation"
runs-on: ubuntu-latest
steps:
- name: "Build project documentation"
uses: ansys/actions/doc-build@v6
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
use-python-cache: false
skip-install: true
requirements-file: doc/requirements.txt
check-links: false
doc-api-reference:
name: "Build API reference documentation"
needs: [doc-build]
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
- name: Build GoPages
run: |
go install github.com/johnstarich/go/gopages@latest
gopages -internal -source-link "https://github.com/ansys/allie-flowkit/blob/main/{{.Path}}{{if .Line}}#L{{.Line}}{{end}}"
- name: Download HTML documentation artifacts
uses: actions/download-artifact@v4
with:
name: documentation-html
path: documentation-html
- name: Run Bash script
run: |
# Set environment variables for file paths
DOC_BUILD_HTML="documentation-html"
SOURCE_FILE="$DOC_BUILD_HTML/api_reference/test/index.html"
SOURCE_DIRECTORY="dist/pkg/github.com/ansys/allie-flowkit/pkg/"
REPLACEMENT_DIRECTORY="$DOC_BUILD_HTML/api_reference/pkg"
ACTUAL_DIR="$DOC_BUILD_HTML/api_reference/"
# Check if REPLACEMENT_DIRECTORY exists, if not, create it
if [ ! -d "$REPLACEMENT_DIRECTORY" ]; then
mkdir -p "$REPLACEMENT_DIRECTORY"
fi
# Remove existing content in the replacement directory
rm -rf "$REPLACEMENT_DIRECTORY"/*
# Move the source_directory content to the replacement_directory
mv "$SOURCE_DIRECTORY"* "$REPLACEMENT_DIRECTORY"
# Remove the index.html file in the replacement_directory
rm "$REPLACEMENT_DIRECTORY/index.html"
# Process each HTML file in the replacement directory
find "$REPLACEMENT_DIRECTORY" -type f -name "*.html" | while IFS= read -r replacement_file; do
replacementBodyContent=$(sed -n '/<body>/,/<\/body>/p' "$replacement_file" | \
sed '/<div class="top-heading" id="heading-wide"><a href="\/pkg\/github.com\/ansys\/allie-flowkit\/">GoPages | Auto-generated docs<\/a><\/div>/,/<a href="#" id="menu-button"><span id="menu-button-arrow">&#9661;<\/span><\/a>/d' | \
sed 's/\//\\\//g')
# Use awk to replace content between specific HTML tags
awk -v repl="$replacementBodyContent" '
/<article class="bd-article" role="main">/,/<\/article>/ {
if ($0 ~ /<article class="bd-article" role="main">/) {
print $0
print repl
while ($0 !~ /<\/article>/) getline
next
}
}
{ print $0 }
' "$SOURCE_FILE" > "$replacement_file"
done
# Move the modified files back to the actual directory
mv "$REPLACEMENT_DIRECTORY"/* "$ACTUAL_DIR"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: documentation-html-with-api
path: documentation-html
upload_docs_release:
name: Upload release documentation
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [release, doc-api-reference]
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@v6
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: documentation-html-with-api