Build ModelBuilder #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build ModelBuilder | |
on: | |
workflow_dispatch: | |
inputs: | |
NEW_RELEASE_TAG: | |
description: 'Tag for new release (e.g. v1.0.2)' | |
required: true | |
jobs: | |
build-mac: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# - name: Replace installed swift with version 6 | |
# run: | | |
# swift --version | |
# curl -o swift.pkg https://download.swift.org/swift-6.0-branch/xcode/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-osx.pkg | |
# sudo installer -pkg swift.pkg -target / | |
# echo "Instalación completa" | |
# which swift | |
# #ls /Library/Developer/Toolchains/ | |
# xcrun --toolchain swift swift --version | |
# #ls -l /Library/Developer/Toolchains/ | |
# #xcrun --show-sdk-path --toolchain swift | |
# export TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw /Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a.xctoolchain/Info.plist) | |
# echo "TOOLCHAINS=$TOOLCHAINS" >> $GITHUB_ENV | |
# swift --version | |
- name: Build program | |
run: | | |
swift --version | |
echo "building" | |
swift build -c release | |
ls .build | |
echo "ls .build/release" | |
ls .build/release | |
echo "file .build/release/ModelBuilder" | |
file .build/release/ModelBuilder | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: mac-output | |
path: .build/release/ModelBuilder | |
build-linux: | |
runs-on: ubuntu-22.04 # specific version because swift and static swift sdk depend on specfic version of ubuntu | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencias for swift compiler # https://www.swift.org/install/linux/tarball/ Instructions depends on version of Ubuntu | |
run: | | |
sudo apt-get update | |
sudo apt-get install \ | |
binutils \ | |
git \ | |
gnupg2 \ | |
libc6-dev \ | |
libcurl4-openssl-dev \ | |
libedit2 \ | |
libgcc-11-dev \ | |
libpython3-dev \ | |
libsqlite3-0 \ | |
libstdc++-11-dev \ | |
libxml2-dev \ | |
libz3-dev \ | |
pkg-config \ | |
python3-lldb-13 \ | |
tzdata \ | |
unzip \ | |
zlib1g-dev | |
- name: Download swift | |
run: | | |
curl -L -o swift.tar.gz https://download.swift.org/swift-6.0-branch/ubuntu2204/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-ubuntu22.04.tar.gz | |
curl -L -o swift.tar.gz.sig https://download.swift.org/swift-6.0-branch/ubuntu2204/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-ubuntu22.04.tar.gz.sig | |
- name: Verify swift | |
run: | | |
gpg --keyserver hkp://keyserver.ubuntu.com \ | |
--recv-keys \ | |
'A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561'\ | |
'E813 C892 820A 6FA1 3755 B268 F167 DF1A CF9C E069' | |
gpg --keyserver hkp://keyserver.ubuntu.com --refresh-keys Swift | |
gpg --verify swift.tar.gz.sig swift.tar.gz | |
- name: Install swift | |
run: | | |
mkdir temp && tar -xzf swift.tar.gz -C temp | |
#mv temp/*/* ./ # Mueve los archivos de la carpeta interna al directorio actual | |
ls temp/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-ubuntu22.04/ | |
which swift | |
sudo cp -fr temp/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-ubuntu22.04/usr/* /usr/local/ | |
PWD=`pwd` | |
#SWIFT_PATH="${PWD}/usr/bin" | |
#echo "${SWIFT_PATH}" >> $GITHUB_PATH | |
#export PATH="${SWIFT_PATH}:${PATH}" # the currently running action cannot access the updated path variable. | |
swift --version | |
- name: Install static linux sdk | |
run: | | |
swift sdk install https://download.swift.org/swift-6.0-branch/static-sdk/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-07-02-a/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-07-02-a_static-linux-0.0.1.artifactbundle.tar.gz --checksum 42a361e1a240e97e4bb3a388f2f947409011dcd3d3f20b396c28999e9736df36 | |
swift sdk list | |
- name: Build program | |
run: | | |
swift --version | |
echo "building" | |
swift build -c release --swift-sdk swift-6.0-DEVELOPMENT-SNAPSHOT-2024-07-02-a_static-linux-0.0.1 | |
echo "ls .build" | |
ls .build | |
echo "ls .build/release" | |
ls .build/release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: linux-output | |
path: .build/release/ModelBuilder | |
build-release: | |
needs: [build-mac, build-linux] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download mac artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: mac-output | |
path: binaries/macos | |
- name: Download linux artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: linux-output | |
path: binaries/linux | |
merge-multiple: true | |
- name: Build zip | |
run: | | |
echo "ls" | |
ls | |
echo "ls linux" | |
ls binaries/linux | |
echo "ls mac" | |
ls binaries/macos | |
cd binaries | |
mv linux/ModelBuilder linux/model-builder_linux_x86_64 | |
mv macos/ModelBuilder macos/model-builder_macos_universal | |
json_content='{ | |
"schemaVersion": "1.0", | |
"artifacts": { | |
"model-builder": { | |
"type": "executable", | |
"version": "1.0.0", | |
"variants": [ | |
{ | |
"path": "macos/model-builder_macos_universal", | |
"supportedTriples": ["x86_64-apple-macosx", "arm64-apple-macosx"] | |
}, | |
{ | |
"path": "linux/model-builder_linux_x86_64", | |
"supportedTriples": ["x86_64-unknown-linux-gnu"] | |
} | |
] | |
} | |
} | |
}' | |
echo "$json_content" > info.json | |
cd .. | |
echo "ls" | |
ls | |
echo "ls linux" | |
ls binaries/linux | |
echo "ls mac" | |
ls binaries/macos | |
#tar -czvf model-builder.tar.gz binaries/ | |
zip -r model-builder.artifactbundle.zip binaries/ | |
echo "Compression done" | |
pwd | |
ls | |
- name: COMPUTE CRC | |
run: | | |
CRC=$(swift package compute-checksum model-builder.artifactbundle.zip) | |
echo "CRC=$CRC" >> $GITHUB_ENV | |
- name: Set up Git | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
# - name: Get version from package.json | |
# id: get_version | |
# run: | | |
# # $(jq -r '.version' package.json) | |
# VERSION="1.0.1" | |
# echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Create tag | |
run: | | |
TAGNAME="${{ github.event.inputs.NEW_RELEASE_TAG }}" | |
echo "1" | |
echo "TAGNAME=$TAGNAME" >> $GITHUB_ENV | |
echo "2" | |
git tag -a "$TAGNAME" -m "Release version $TAGNAME" | |
echo "3" | |
git push origin "$TAGNAME" | |
echo "4" | |
#git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}" | |
#git push origin "v${{ env.VERSION }}" | |
- name: Create release | |
id: create-release | |
uses: softprops/action-gh-release@v2 | |
# if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: 'ModelBuilder' | |
tag_name: ${{ env.TAGNAME }} | |
body: "ModelBuilder checksum: ${{ env.CRC }}" | |
files: | |
model-builder.artifactbundle.zip | |
- name: OUTPUT URLs | |
run: | | |
echo "URL asset[0]: ${{ fromJSON(steps.create-release.outputs.assets)[0].browser_download_url }}" | |
echo "URL release: ${{ steps.create-release.outputs.url }}" | |