-
Notifications
You must be signed in to change notification settings - Fork 1
128 lines (120 loc) · 4.39 KB
/
release.yml
File metadata and controls
128 lines (120 loc) · 4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: release workflow
on:
push:
branches: [main]
permissions: {}
jobs:
get_config_values:
uses: NHSDigital/eps-common-workflows/.github/workflows/get-repo-config.yml@76baf9dd964311c337af3ec78e8cb1e915c006ce
permissions:
attestations: read
contents: read
packages: read
with:
verify_published_from_main_image: true
quality_checks:
needs: [get_config_values]
uses: NHSDigital/eps-common-workflows/.github/workflows/quality-checks-devcontainer.yml@76baf9dd964311c337af3ec78e8cb1e915c006ce
permissions:
contents: read
id-token: write
packages: read
with:
pinned_image: ${{ needs.get_config_values.outputs.pinned_image }}
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
get_commit_id:
runs-on: ubuntu-22.04
outputs:
commit_id: ${{ steps.commit_id.outputs.commit_id }}
steps:
- name: Get Commit ID
id: commit_id
run: |
echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
tag_release:
needs: [quality_checks, get_commit_id, get_config_values]
uses: NHSDigital/eps-common-workflows/.github/workflows/tag-release-devcontainer.yml@6a7443adade993bcd35e70cf4b18f83f62ed5d13
permissions:
id-token: write
contents: write
packages: write
with:
dry_run: false
pinned_image: ${{ needs.get_config_values.outputs.pinned_image }}
branch_name: main
tag_format: ${{ needs.get_config_values.outputs.tag_format }}
generate_behave_steps_catalog:
needs: [quality_checks, get_config_values]
runs-on: ubuntu-22.04
permissions:
contents: write
container:
image: ${{ needs.get_config_values.outputs.pinned_image }}
options: --user 1001:1001 --group-add 128
defaults:
run:
shell: bash
steps:
- name: copy .tool-versions
run: |
cp /home/vscode/.tool-versions "$HOME/.tool-versions"
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
persist-credentials: false
fetch-depth: 0
- name: Cache Virtualenv
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae
id: cache-venv
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('pyproject.toml') }}
- name: Install python packages
if: steps.cache-venv.outputs.cache-hit != 'true'
run: make install
- name: Checkout gh-pages
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
ref: gh-pages
path: gh-pages
persist-credentials: true
- name: Generate Behave steps catalog as HTML
run: |
set +H # Disable history expansion to prevent !DOCTYPE error
{
echo "<!DOCTYPE html>"
echo "<html lang='en'>"
echo "<head>"
echo " <meta charset='UTF-8'>"
echo " <meta name='viewport' content='width=device-width, initial-scale=1.0'>"
echo " <title>Behave Steps Catalog</title>"
echo " <style>"
echo " body { font-family: 'Courier New', monospace; background-color: #f4f4f4; padding: 2rem; }"
echo " pre { background:
white; border: 1px solid #ccc; padding: 1rem; overflow-x: auto; }"
echo " h1 { font-family: sans-serif; }"
echo " </style>"
echo "</head>"
echo "<body>"
echo " <h1>Behave Steps Catalog</h1>"
echo " <pre>"
# Escape HTML special characters to ensure valid output
# 2>/dev/null suppresses behave warnings; || true prevents non-zero exit codes from failing the step
(poetry run behave --steps-catalog 2>/dev/null || true) | python -c "import sys, html; print(html.escape(sys.stdin.read()))"
echo " </pre>"
echo "</body>"
echo "</html>"
} > gh-pages/index.html
- name: Update docs in github pages
run: |
cd gh-pages
if git diff --quiet -- index.html; then
echo "No changes in index.html. Skipping git add, commit, and push."
exit 0
fi
git config user.name github-actions
git config user.email github-actions@github.com
git add "index.html"
git commit -m "update behave catalogue"
parallel --retries 10 --delay 3 ::: "git pull --rebase && git push"