Skip to content

test

test #7

Workflow file for this run

# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json
# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: Release workflow
on:
release:
types: [published, edited]
jobs:
get-app-name:
runs-on: ubuntu-22.04
name: Get App-Name
outputs:
app_name: ${{ steps.export-app-name.outputs.app_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get app-name
id: export-app-name
run: |
NAME=$(cat ./app/AppManifest.json | jq -r '.name')
echo "app_name=$NAME" >> $GITHUB_OUTPUT
gen-desired-state:
uses: ./.github/workflows/gen-desired-state.yml
needs: [get-app-name]
with:
app_name: ${{ needs.get-app-name.outputs.app_name }}
upload-images:
name: "Upload image (${{ needs.get-app-name.outputs.app_name }})"
runs-on: ubuntu-22.04
needs: get-app-name
env:
APP_NAME: ${{ needs.get-app-name.outputs.app_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- id: get_version
uses: battila7/get-version-action@v2
- run: echo "Using VehicleApp version ${{ steps.get_version.outputs.version-without-v }} from tag"
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: github-repository-name-case-adjusted
name: Prepare repository name in lower case for docker upload.
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository }}
- name: Wait for Multi-Arch build to succeed
uses: fountainhead/[email protected]
with:
checkName: Merge Trivy results
token: ${{ secrets.GITHUB_TOKEN }}
timeoutSeconds: 1800
intervalSeconds: 20
- name: Download builds from Build multiarch image workflow artifacts
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-multiarch-image.yml
workflow_conclusion: success
commit: ${{ github.sha }}
path: ${{github.workspace}}
- name: "${{ env.APP_NAME }} -- Publish release image to GHCR"
working-directory: ${{github.workspace}}
env:
VAPP_IMAGE: ${{ env.APP_NAME }}-multiarch-oci-archive/${{ env.APP_NAME }}-oci-multiarch.tar
VAPP_NAME: ${{ env.APP_NAME }}
VAPP_VERSION: ${{ steps.get_version.outputs.version-without-v }}
REGISTRY: "ghcr.io/${{steps.github-repository-name-case-adjusted.outputs.lowercase}}"
run: |
tag=$(echo docker://$REGISTRY/$VAPP_NAME:$VAPP_VERSION | tr '[:upper:]' '[:lower:]')
echo "Copy vApp image $VAPP_IMAGE to '$tag'"
skopeo copy --all oci-archive:$VAPP_IMAGE "$tag"
- name: ${{ env.APP_NAME }} -- Upload assets
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{github.workspace}}/AppManifest/AppManifest.json
${{github.workspace}}/binaries/*
${{github.workspace}}/${{ env.APP_NAME }}-multiarch-docker-archive/*
release-documentation:
name: Generate release documentation
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
check-latest: true
- name: Conditional input event value
uses: haya14busa/action-cond@v1
id: condval
with:
cond: ${{ !github.event.inputs.name }}
if_true: ${{ github.event.inputs.name }}
if_false: ${{ github.sha }}
- name: Wait for CI workflow to succeed
uses: fountainhead/[email protected]
with:
checkName: Build, Test and Lint
token: ${{ secrets.GITHUB_TOKEN }}
timeoutSeconds: 1200
intervalSeconds: 30
- name: Download artifact from CI workflow
uses: dawidd6/action-download-artifact@v3
with:
workflow: ci.yml
workflow_conclusion: success
commit: ${{ steps.condval.outputs.value }}
path: generated_md
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.89.4"
extended: true
- name: Set tags output
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Check output
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
run: |
echo $RELEASE_VERSION
echo ${{ steps.vars.outputs.tag }}
- name: Create and Add reports to hugo static html site
run: |
hugo new site hugo
cp ./README.md ./hugo/content/_index.md
mkdir ./hugo/content/documentation
mkdir ./hugo/content/reports
cp ./README.md ./hugo/content/documentation/_index.md
sed -i '1d' hugo/content/documentation/_index.md
sed -i '1s/^/---\ntitle: "VehicleApp using cpp"\ndraft: false\n---\n/' hugo/content/documentation/_index.md
cp generated_md/test-results/* ./hugo/content/reports
sed -i '1s/^/---\ntitle: "Code Coverage Test"\ndraft: false\n---\n/' hugo/content/reports/code-coverage-results.md
sed -i '1s/^/---\ntitle: "Unit Test Results"\ndraft: false\n---\n/' hugo/content/reports/test-results.md
mkdir ./hugo/config
mkdir ./hugo/config/_default
mkdir ./hugo/config/pages
echo $'languageCode = "en-us"\ntitle = "Release Documentation - @tag"\n\nbaseURL = "http://example.org/"\n\n# Keep uglyURLs for now, as this provides the best out of the box support for rendering markdown images in VSCode preview and Hugo\n# Link: https://gohugo.io/content-management/urls/#ugly-urls\nuglyURLs = "true"\n\nenableGitInfo = true\n\ntheme = "hugo-geekdoc"\n\n# Geekdoc required configuration\npygmentsUseClasses = true\npygmentsCodeFences = true\ndisablePathToLower = true\n\n[markup]\ndefaultMarkdownHandler = "goldmark"\n\n[markup.goldmark.renderer]\nunsafe = true\n\n[markup.tableOfContents]\n ordered= false\n startLevel= 1\n endLevel= 3\n\n[params]\ngeekdocRepo = "https://github.com/eclipse-velocitas/vehicle-app-cpp-template"\ngeekdocEditPath = "edit/main/hugo/content"\ngeekdocCollapseSection = true\n' > ./hugo/config/_default/config.toml
echo $'# Hugo-Geekdoc Theme Config\n\nbaseURL = "https://fantastic-fiesta-da4ab8e5.pages.github.io/"\n\ntheme = "hugo-geekdoc"\n\nenableGitInfo = false\n\npluralizeListTitles = false\npygmentsUseClasses = true\n\n[markup]\n defaultMarkdownHandler = "goldmark"\n\n[markup.highlight]\n anchorLineNos = false\n codeFences = true\n guessSyntax = false\n hl_Lines = ""\n lineAnchors = ""\n lineNoStart = 1\n lineNos = true\n lineNumbersInTable = true\n noClasses = false\n style = "paraiso-dark"\n tabWidth = 4\n\n[markup.tableOfContents]\n endLevel = 3\n ordered = false\n startLevel = 1\n\n[markup.goldmark.extensions]\n typographer = true\n\n[markup.goldmark.renderer]\n unsafe = true\n\n# Disable geekdoc default theme settings\n[params]\ngeekdocRepo = ""\ngeekdocEditPath = ""\n# disable non-working search when serving from local file system\ngeekdocSearch = false\n' > ./hugo/config/pages/config.toml
mkdir hugo/data/menu
echo "---" > ./hugo/data/menu/extra.yaml
printf "header:\n - name: GitHub\n ref: https://github.com/eclipse-velocitas/vehicle-app-cpp-template\n icon: gdoc_github\n external: true\n" >> ./hugo/data/menu/extra.yaml
echo "---" > ./hugo/data/menu/more.yaml
printf 'more:\n - name: Releases\n ref: "https://github.com/eclipse-velocitas/vehicle-app-cpp-template/releases"\n external: true\n icon: "gdoc_download"\n - name: "View Source"\n ref: "https://github.com/eclipse-velocitas/vehicle-app-cpp-template/tree/@tag"\n external: true\n icon: "gdoc_github"\n' >> ./hugo/data/menu/more.yaml
sed -i -e 's/@tag/${{ steps.vars.outputs.tag }}/g' ./hugo/config/_default/config.toml
sed -i -e 's/@tag/${{ steps.vars.outputs.tag }}/g' ./hugo/data/menu/more.yaml
- name: Build
working-directory: ${{github.workspace}}/hugo
env:
GEEKDOC_THEME_VERSION: 0.21.1
# hugo --minify not fully supported by hugo-geekdoc theme
run: |
echo "Download theme hugo-geekdoc v${GEEKDOC_THEME_VERSION}"
mkdir -p themes/hugo-geekdoc/
curl -L https://github.com/thegeeklab/hugo-geekdoc/releases/download/v${GEEKDOC_THEME_VERSION}/hugo-geekdoc.tar.gz | tar -xz -C themes/hugo-geekdoc/ --strip-components=1
echo "Build release documentation for GitHub Pages"
hugo -d ./public --environment=pages
- name: zip
run: |
cd ${{github.workspace}}/hugo/public
zip -r ${{github.workspace}}/release-documentation.zip .
- name: Upload assets
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
release-documentation.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to GH Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{github.workspace}}/hugo/public
publish_branch: gh_pages