Update Release workflow (#858)

Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com>
This commit is contained in:
Slava 2024-07-10 21:14:28 +03:00 committed by GitHub
parent 3ae73197c2
commit 8f740b42e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 48 additions and 36 deletions

View File

@ -8,11 +8,12 @@ on:
env: env:
cache_nonce: 0 # Allows for easily busting actions/cache caches cache_nonce: 0 # Allows for easily busting actions/cache caches
nim_version: v1.6.14 nim_version: pinned
rust_version: 1.78.0 rust_version: 1.78.0
binary_base: codex binary_base: codex
build_dir: build
nim_flags: '-d:verify_circuit=true' nim_flags: '-d:verify_circuit=true'
upload_to_codex: false windows_libs: 'libstdc++-6.dll libgomp-1.dll libgcc_s_seh-1.dll libwinpthread-1.dll'
jobs: jobs:
# Matrix # Matrix
@ -75,13 +76,21 @@ jobs:
- name: Release - Build - name: Release - Build
run: | run: |
make NIMFLAGS="--out:${{ env.binary }} ${{ env.nim_flags }}" make NIMFLAGS="--out:${{ env.build_dir }}/${{ env.binary }} ${{ env.nim_flags }}"
- name: Release - Upload binaries - name: Release - Libraries
run: |
if [[ "${{ matrix.os }}" == "windows" ]]; then
for lib in ${{ env.windows_libs }}; do
cp -v "${MINGW_PREFIX}/bin/${lib}" "${{ env.build_dir }}"
done
fi
- name: Release - Upload build artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: release-${{ env.binary }} name: release-${{ env.binary }}
path: ${{ env.binary }} path: ${{ env.build_dir }}/
retention-days: 1 retention-days: 1
# Release # Release
@ -100,46 +109,49 @@ jobs:
- name: Release - Compress and checksum - name: Release - Compress and checksum
run: | run: |
cd /tmp/release cd /tmp/release
prepare() { checksum() {
# Checksum
arc="${1}" arc="${1}"
sha256sum "${arc}" >"${arc}.sha256" sha256sum "${arc}" >"${arc}.sha256"
# Upload to Codex
if [[ "${{ env.upload_to_codex }}" == "true" ]]; then
codex_endpoints="${{ secrets.CODEX_ENDPOINTS }}"
codex_username="${{ secrets.CODEX_USERNAME }}"
codex_password="${{ secrets.CODEX_PASSWORD }}"
for endpoint in ${codex_endpoints}; do
echo "::add-mask::${endpoint}"
cid=$(curl -X POST \
"${endpoint}/api/codex/v1/data" \
-u "${codex_username}":"${codex_password}" \
-H "content-type: application/octet-stream" \
-T "${arc}")
echo "${cid}" >"${arc}.cid"
done
fi
} }
# Compress and prepare # Compress and prepare
for file in *; do for file in *; do
if [[ "${file}" == *".exe"* ]]; then # Exclude libraries
arc="${file%.*}.zip" if [[ "${file}" != *".dll"* ]]; then
zip "${arc}" "${file}" if [[ "${file}" == *".exe"* ]]; then
rm -f "${file}"
prepare "${arc}" # Windows - binary only
else arc="${file%.*}.zip"
arc="${file}.tar.gz" zip "${arc}" "${file}"
tar cfz "${arc}" "${file}" checksum "${arc}"
rm -f "${file}"
prepare "${arc}" # Windows - binary and libs
arc="${file%.*}-libs.zip"
zip "${arc}" "${file}" ${{ env.windows_libs }}
rm -f "${file}" ${{ env.windows_libs }}
checksum "${arc}"
else
# Linux/macOS
arc="${file}.tar.gz"
chmod 755 "${file}"
tar cfz "${arc}" "${file}"
rm -f "${file}"
checksum "${arc}"
fi
fi fi
done done
- name: Release - Upload compressed artifacts and checksums
uses: actions/upload-artifact@v4
with:
name: archives-and-checksums
path: /tmp/release/
retention-days: 1
- name: Release - name: Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with: with:
files: | files: |
/tmp/release/* /tmp/release/*