@@ -31,36 +31,26 @@ jobs:
3131 runs-on : ubuntu-22.04
3232
3333 steps :
34- # E.g. "2025-11-02"
35- - name : Determine release tag
36- run : |
37- release_tag="$(date +'%Y-%m-%d')"
38- echo $release_tag
39- echo "RELEASE_TAG=$release_tag" >> $GITHUB_ENV
40-
41- # E.g. "20251102"
42- - name : Determine package tag
43- run : |
44- package_tag="${RELEASE_TAG//-/}"
45- echo $package_tag
46- echo "PACKAGE_TAG=$package_tag" >> $GITHUB_ENV
47-
4834 # Check out the this repo in the workflow work directory.
4935 - name : Checkout this repo
5036 uses : actions/checkout@v4
5137
52- - name : Install anti virus (ClamAV)
53- run : |
54- sudo apt-get update
55- sudo apt-get install -y clamav clamav-daemon
56- sudo systemctl stop clamav-freshclam || true
57- sudo freshclam --verbose
38+ - name : Get release and package tags
39+ uses : fpgawars/apio-workflows/.github/actions/get-release-and-package-tags@main
40+ with :
41+ release-tag-var : RELEASE_TAG
42+ package-tag-var : PACKAGE_TAG
5843
59- - name : Determine last commit
60- run : |
61- commit=$(git rev-parse HEAD)
62- echo $commit
63- echo "RELEASE_COMMIT=$commit" >> $GITHUB_ENV
44+ - name : Ensure no conflicting release
45+ uses : fpgawars/apio-workflows/.github/actions/ensure-no-conflicting-release@main
46+ with :
47+ release-tag : ${{ env.RELEASE_TAG }}
48+
49+ - name : Get repository commit
50+ uses : fpgawars/apio-workflows/.github/actions/get-repository-commit@main
51+ with :
52+ repo-dir : .
53+ env-var-name : RELEASE_COMMIT
6454
6555 - name : Create the build-info.json file
6656 run : |
@@ -81,12 +71,10 @@ jobs:
8171
8272 cat -n build-info.json
8373
84- # This tool is used also by build.py
85- - name : Format build info
86- run : |
87- npm install -g json-align
88- json-align --in-place --spaces 2 build-info.json
89- cat -n build-info.json
74+ - name : Format build info json file in-place
75+ uses : fpgawars/apio-workflows/.github/actions/format-json-file@main
76+ with :
77+ json-file : build-info.json
9078
9179 - name : Make the build info file read only
9280 run : |
@@ -139,49 +127,14 @@ jobs:
139127
140128 cat -n $out
141129
142- # Delete old pre-releases, keeps all releases.
143- - name : Delete old pre-releases
144- uses : sgpublic/delete-release-action@v1.2
145- with :
146- # Keep all stable releases .
147- release-drop : false
148- # Delete old pre-releases, keep the newest 10 (excluding the absolute latest)
149- pre-release-drop : true
150- pre-release-keep-count : 5
151- pre-release-drop-tag : true # Also delete tags of deleted pre-releases
152- # Keep all drafts.
153- draft-drop : false
154- env :
155- GITHUB_TOKEN : ${{ github.token }}
156-
157-
158-
159- # Scans recursively inside the .tgz packages.
160- # See https://linux.die.net/man/1/clamscan
161- - name : Scan the packages for viruses
162- run : |
163- clamscan -r --verbose --scan-archive=yes _packages/apio-verible-*.tgz
130+ - name : Cleanup old pre-releases
131+ uses : fpgawars/apio-workflows/.github/actions/cleanup-old-prereleases@main
164132
165- - name : Delete same tag pre-release if exist.
166- run : |
167- set -e
168- gh release list --limit 100
169- output=$(gh release view "$RELEASE_TAG" --json name,tagName,isDraft,isImmutable,isPrerelease 2>&1 || true)
170- echo $output
171- if [[ "$output" == "release not found" ]]; then
172- echo "Release $RELEASE_TAG does not exist, safe to continue."
173- elif [[ "$(echo "$output" | jq -r '.isPrerelease')" == "true" ]]; then
174- echo "Release $RELEASE_TAG exists and is a pre-release, deleting."
175- gh release delete "$RELEASE_TAG" --yes --cleanup-tag
176- elif [[ "$(echo "$output" | jq -r '.isPrerelease')" == "false" ]]; then
177- echo "Error: A stable release (non pre-release) already exists for tag $RELEASE_TAG."
178- exit 1
179- else
180- echo "Error determining if release $RELEASE_TAG exists"
181- exit 1
182- fi
183- env :
184- GITHUB_TOKEN : ${{ github.token }}
133+ - name : Scan the package for viruses
134+ uses : fpgawars/apio-workflows/.github/actions/scan-files-for-viruses@main
135+ with :
136+ file-patterns : |
137+ _packages/apio-verible-*.tgz
185138
186139 - name : Create the Release and upload files
187140 uses : softprops/action-gh-release@v2.2.2
0 commit comments