Skip to content

Commit 9ff5cc0

Browse files
committed
Update documentation
- Update HTML documentation. - Automatic tagging from Github workflow.
1 parent 2d1d8a3 commit 9ff5cc0

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

.github/workflows/full-staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ name: (Staging) - Full
1212
run-name: "#${{ github.run_number }}: ${{ github.event.pull_request.title }}"
1313
jobs:
1414
full-staging:
15-
uses: dmg0345/commonapi_cpp_examples/.github/workflows/reusable-full.yml@master
15+
uses: dmg0345/commonapi_cpp_examples/.github/workflows/reusable-full.yml@feature/update_docs
1616
secrets:
1717
netlify_pat: ${{ secrets.NETLIFY_PAT }}
1818
netlify_site_id: ${{ secrets.NETLIFY_SITE_ID }}

.github/workflows/reusable-full.yml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,49 @@ jobs:
7878
ref: ${{ github.sha }}
7979
path: ${{ env.CLONE_FOLDER }}
8080
submodules: recursive
81+
- name: Tag commit on production
82+
run: |
83+
# Enter folder with repository.
84+
Push-Location "$($ENV:CLONE_FOLDER)";
85+
86+
# Get current version from configuration file.
87+
$confFile = Get-Content "./doc/conf.py" -Encoding utf8 -Raw;
88+
$confMatch = $confFile -Match 'version[\s]*=[\s]*"([0-9]+\.[0-9]+\.[0-9]+)"[\s]*';
89+
if ($confMatch -eq $false) { throw "Unable to retrieve version from configuration file..."; }
90+
$currVersion = $Matches[1];
91+
92+
# Attempt to tag only on 'production' kind of deployments.
93+
if ('${{ inputs.deploy }}' -eq "production")
94+
{
95+
# Fetch all tags from remote.
96+
git fetch --tags --force;
97+
if ($LastExitCode -ne 0) { throw "Unable to fetch tags from repository."; }
98+
99+
# Check if current commit is already tagged, in which case skip it.
100+
$out = git tag -l -n0 --points-at "${{ github.sha }}";
101+
if ($LastExitCode -ne 0) { throw "Unable to determine if current commit is tagged."; }
102+
if ($out.Length -eq 0)
103+
{
104+
$out = git tag -l -n0 "$currVersion";
105+
if ($LastExitCode -ne 0) { throw "Unable to determine if tag exists for version."; }
106+
if ($out.Length -ne 0) { throw "Version '$out' is already tagged."; }
107+
108+
# Create tag locally for documentation and other purposes, do not push, would need perms.
109+
git tag "$currVersion" "${{ github.sha }}";
110+
if ($LastExitCode -ne 0) { throw "Unable to create tag '$currVersion' for '${{ github.sha }}'"; }
111+
}
112+
else
113+
{
114+
Write-Host "Commit '${{ github.sha }}' is already tagged...";
115+
}
116+
}
117+
else
118+
{
119+
Write-Host "No tagging necessary for '${{ inputs.deploy }}' deployment...";
120+
}
121+
122+
# Return to original folder.
123+
Pop-Location;
81124
- name: Build every target with CMake
82125
run: |
83126
# Enter Python virtual environment.
@@ -115,7 +158,6 @@ jobs:
115158
tar `
116159
--exclude="*.obj" `
117160
--exclude="*.o" `
118-
--exclude="*.pdf" `
119161
--exclude="$($cfg.Name)/.git" `
120162
-cf "$($cfg.Name).repo.tar.gz" "$($cfg.Name)";
121163
if ($LastExitCode -ne 0) { throw "$($cfg.Name): Compressing the repository failed with error '$LastExitCode'." }

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# Project copyright.
3030
copyright = author
3131
# Project version.
32-
version = "0.0.2"
32+
version = "0.0.3"
3333
# Project release, set it as the same value as version as the separation is not required.
3434
release = version
3535

0 commit comments

Comments
 (0)