Skip to content

Commit 9b4b74b

Browse files
authored
Merge pull request #3 from zapta/main
Updated the build workflow of the graphviz package
2 parents d5d1971 + 3f4782d commit 9b4b74b

File tree

4 files changed

+164
-45
lines changed

4 files changed

+164
-45
lines changed
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Daily build and release workflow.
2+
3+
name: build-and-release
4+
5+
on:
6+
# Run on each commit to this repo.
7+
push:
8+
9+
# Run daily at 10AM UTC
10+
schedule:
11+
- cron: "0 10 * * *"
12+
13+
# Allow manual activations.
14+
workflow_dispatch:
15+
16+
permissions:
17+
# Allow release creation
18+
contents: write
19+
20+
env:
21+
# -- Set the version of the upstream release.
22+
# -- See list at https://graphviz.gitlab.io/download/
23+
GRAPHVIZ_TAG: 12.1.2
24+
25+
jobs:
26+
# -- Build packages for all supported architectures and
27+
# -- export them in a release.
28+
build-and-release:
29+
runs-on: ubuntu-22.04
30+
31+
steps:
32+
# Check out the this repo in the workflow work directory.
33+
- name: Checkout this repo
34+
uses: actions/checkout@v4
35+
36+
# E.g. "2025-11-02"
37+
- name: Determine release tag
38+
run: |
39+
release_tag="$(date +'%Y-%m-%d')"
40+
echo ${release_tag}
41+
echo "RELEASE_TAG=${release_tag}" >> $GITHUB_ENV
42+
43+
# E.g. "20251102"
44+
- name: Determine package tag
45+
run: |
46+
package_tag="${RELEASE_TAG//-/}"
47+
echo $package_tag
48+
echo "PACKAGE_TAG=$package_tag" >> $GITHUB_ENV
49+
50+
- name: Determine last commit
51+
run: |
52+
commit=$(git rev-parse HEAD)
53+
echo $commit
54+
echo "RELEASE_COMMIT=$commit" >> $GITHUB_ENV
55+
56+
- name: Determine package file name
57+
run: |
58+
package_name="apio-graphviz-windows-amd64-${PACKAGE_TAG}.tgz"
59+
echo $package_name
60+
echo "PACKAGE_NAME=$package_name" >> $GITHUB_ENV
61+
62+
- name: Create the build info file
63+
run: |
64+
cat > build-info.json <<EOF
65+
{
66+
"package-name": "graphviz",
67+
"description" : "Graphviz tools for Apio",
68+
"target-platform": "windows-amd64",
69+
"release-tag": "${RELEASE_TAG}",
70+
"build-repo": "${{github.repository}}",
71+
"build-workflow": "${{ github.workflow }}",
72+
"workflow-run-id": "${{github.run_id}}",
73+
"workflow-run-number": "${{github.run_number}}",
74+
"build-time": "$(date +'%Y-%m-%d %H:%M:%S %Z')",
75+
"commit": "$RELEASE_COMMIT",
76+
"file-name": "$PACKAGE_NAME"
77+
}
78+
EOF
79+
80+
cat -n build-info.json
81+
82+
- name: Format build info
83+
run: |
84+
npm install -g json-align
85+
json-align --in-place --spaces 2 build-info.json
86+
cat -n build-info.json
87+
88+
- name: Construct graphviz file name
89+
run: |
90+
graphviz_fname="windows_10_cmake_Release_Graphviz-${GRAPHVIZ_TAG}-win64.zip"
91+
echo ${graphviz_fname}
92+
echo "GRAPHVIZ_FNAME=${graphviz_fname}" >> $GITHUB_ENV
93+
94+
- name: Download graphviz file to _upstream
95+
run: |
96+
url="https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/${GRAPHVIZ_TAG}/${GRAPHVIZ_FNAME}"
97+
echo $url
98+
mkdir _upstream
99+
pushd _upstream
100+
wget -nv $url
101+
popd
102+
find _upstream
103+
104+
- name: Uncompress the graphviz file
105+
run: |
106+
pushd _upstream
107+
unzip ${GRAPHVIZ_FNAME}
108+
popd
109+
find _upstream
110+
111+
- name: Move upstream package to _package
112+
run: |
113+
mv _upstream/Graphviz-${GRAPHVIZ_TAG}-win64 _package
114+
ls -al _package
115+
116+
- name: Copy build info file to _package
117+
run: |
118+
cp build-info.json _package/BUILD-INFO.json
119+
ls -al _package
120+
121+
- name: Compress the package
122+
run: |
123+
pushd _package
124+
tar zcf ../${PACKAGE_NAME} ./*
125+
popd
126+
ls -al
127+
128+
- name: Prepare release text
129+
run: |
130+
cat > RELEASE_BODY.txt <<EOF
131+
This is an automated build-and-release.
132+
133+
Build info:
134+
\`\`\`
135+
$(tr -d '",{}' < build-info.json)
136+
\`\`\`
137+
EOF
138+
139+
cat -n $out
140+
141+
# In case we overwrite and exiting release.
142+
- name: Force tag update
143+
run: |
144+
git tag -f ${{env.RELEASE_TAG}}
145+
git push origin -f ${{env.RELEASE_TAG}}
146+
147+
- name: Create the Release and upload files
148+
uses: softprops/[email protected]
149+
with:
150+
tag_name: ${{env.RELEASE_TAG}}
151+
name: ${{env.RELEASE_TAG}}
152+
body_path: RELEASE_BODY.txt
153+
preserve_order: true
154+
fail_on_unmatched_files: true
155+
files: |
156+
apio-graphviz-windows-amd64-${{env.PACKAGE_TAG}}.tgz

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
_upstream/
22
_packages/
3-
VERSION_BUILD
43
.run.sh
54
.DS_Store
65
.wget-hsts

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"cSpell.words": [
3+
"FNAME",
4+
"GRAPHVIZ",
5+
"popd",
6+
"pushd"
7+
]
8+
}

build.sh

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)