Release #12
Workflow file for this run
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: "Release" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BIFROEST_VENDOR: "Engity GmbH" | |
on: | |
release: | |
types: [ published ] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version to be released (syntax: v<major>.<minor>.<patch>)" | |
required: true | |
jobs: | |
release: | |
name: "Release" | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/engity-com/build-images/go | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache Go | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Cache images dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .cache/dependencies/images | |
key: images-dependencies | |
restore-keys: images-dependencies | |
- name: Git configure | |
run: | | |
git config --global --add safe.directory $(pwd) | |
- name: Install dependencies | |
run: | | |
go mod download | |
- name: Test | |
run: | | |
mkdir -p var | |
go test -v ./... | |
- name: Build/Release | |
run: | | |
go run ./cmd/build build --log.colorMode=always | |
documentation: | |
name: "Documentation" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: true | |
- name: Create temp repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: true | |
path: var/doc | |
- name: Setup Git | |
working-directory: var/doc | |
run: | | |
git config user.email "info@engity.com" | |
git config user.name "Engity Bot" | |
- name: Prepare temp repository | |
working-directory: var/doc | |
run: | | |
git branch -d temp-deploy || true | |
git switch --orphan temp-deploy | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
pip install -r docs/requirements.txt | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ hashFiles('docs/requirements.txt') }} | |
- name: Build | |
run: | | |
VERSION_INPUT="${{ github.event.inputs.version }}" | |
VERSION_REF="${{ github.ref }}" | |
export VERSION=$(test -z "${VERSION_INPUT}" && echo $(echo "${VERSION_REF}" | sed -e "s#^refs/tags/##g" | sed -e "s#^v##g") || echo "${VERSION_INPUT}") | |
echo "Version: ${VERSION}" | |
mkdocs --color build -c | |
rm -f var/doc/requirements.txt | |
- name: Deploy | |
working-directory: var/doc | |
run: | | |
git add -A | |
git commit -m "Release v${{ github.event.inputs.version }}" | |
git push --delete origin "docs/v${{ github.event.inputs.version }}" || true | |
git tag -d "docs/v${{ github.event.inputs.version }}" || true | |
git tag -a "docs/v${{ github.event.inputs.version }}" -m "Release v${{ github.event.inputs.version }}" | |
git push origin "docs/v${{ github.event.inputs.version }}" | |
echo "Documentation is available at https://bifroest.engity.org/v${{ github.event.inputs.version }}/" >> "$GITHUB_STEP_SUMMARY" |