-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ddb980
commit f171843
Showing
8 changed files
with
212 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
create-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
- run: echo ::set-env name=UPLOAD_URL::'${{ steps.create_release.outputs.upload_url }}' > upload_url | ||
- name: Upload upload_url | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: upload_url | ||
path: upload_url | ||
|
||
build: | ||
needs: create-release | ||
strategy: | ||
matrix: | ||
platform: [ | ||
'linux-arm', | ||
'linux-arm64', | ||
'linux-x64', | ||
'darwin-x64', | ||
] | ||
pair: [ | ||
'node:8', | ||
'node:10', | ||
'node:12', | ||
'node:14', | ||
] | ||
include: | ||
- platform: 'linux-arm' | ||
host-os: 'ubuntu-latest' | ||
- platform: 'linux-arm64' | ||
host-os: 'ubuntu-latest' | ||
- platform: 'linux-x64' | ||
host-os: 'ubuntu-latest' | ||
- platform: 'darwin-x64' | ||
host-os: 'macos-latest' | ||
- pair: 'node:8' | ||
language: 'node' | ||
version: '8' | ||
- pair: 'node:10' | ||
language: 'node' | ||
version: '10' | ||
- pair: 'node:12' | ||
language: 'node' | ||
version: '12' | ||
- pair: 'node:14' | ||
language: 'node' | ||
version: '14' | ||
|
||
runs-on: ${{ matrix.host-os }} | ||
|
||
steps: | ||
- name: Download upload_url | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: upload_url | ||
- name: Set upload_url env var | ||
run: cat upload_url/upload_url | ||
- name: Set env | ||
run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:11}) | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.version }} | ||
- name: Build adapter | ||
run: | | ||
./build.sh "${{ matrix.platform }}" "${{ matrix.language }}" "${{ matrix.version }}" | ||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ env.UPLOAD_URL }} | ||
asset_path: homekit-adapter-${{ env.RELEASE_VERSION }}-${{ matrix.platform }}-v${{ matrix.version }}.tgz | ||
asset_name: homekit-adapter-${{ env.RELEASE_VERSION }}-${{ matrix.platform }}-v${{ matrix.version }}.tgz | ||
asset_content_type: application/zip | ||
- name: Upload Release Asset Checksum | ||
id: upload-release-asset-checksum | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ env.UPLOAD_URL }} | ||
asset_path: homekit-adapter-${{ env.RELEASE_VERSION }}-${{ matrix.platform }}-v${{ matrix.version }}.tgz.sha256sum | ||
asset_name: homekit-adapter-${{ env.RELEASE_VERSION }}-${{ matrix.platform }}-v${{ matrix.version }}.tgz.sha256sum | ||
asset_content_type: text/plain |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash -e | ||
|
||
ADDON_ARCH="$1" | ||
LANGUAGE_NAME="$2" | ||
LANGUAGE_VERSION="$3" | ||
|
||
function map_posix_tools() { | ||
tar() { | ||
gtar "$@" | ||
return $! | ||
} | ||
export -f tar | ||
|
||
readlink() { | ||
greadlink "$@" | ||
return $! | ||
} | ||
export -f readlink | ||
|
||
find() { | ||
gfind "$@" | ||
return $! | ||
} | ||
export -f find | ||
} | ||
|
||
function install_osx_compiler() { | ||
brew install \ | ||
boost \ | ||
cmake \ | ||
coreutils \ | ||
eigen \ | ||
findutils \ | ||
gnu-tar \ | ||
pkg-config | ||
map_posix_tools | ||
} | ||
|
||
function install_linux_cross_compiler() { | ||
sudo apt -qq update | ||
sudo apt install --no-install-recommends -y \ | ||
binfmt-support \ | ||
qemu \ | ||
qemu-user-static | ||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | ||
} | ||
|
||
function build_native() { | ||
ADDON_ARCH=${ADDON_ARCH} ./package.sh | ||
} | ||
|
||
function build_cross_compiled() { | ||
docker run --rm -t -v $PWD:/build webthingsio/toolchain-${ADDON_ARCH}-${LANGUAGE_NAME}-${LANGUAGE_VERSION} bash -c "cd /build; ADDON_ARCH=${ADDON_ARCH} ./package.sh" | ||
} | ||
|
||
case "${ADDON_ARCH}" in | ||
darwin-x64) | ||
install_osx_compiler | ||
build_native | ||
;; | ||
|
||
linux-arm) | ||
install_linux_cross_compiler | ||
build_cross_compiled | ||
;; | ||
|
||
linux-arm64) | ||
install_linux_cross_compiler | ||
build_cross_compiled | ||
;; | ||
|
||
linux-x64) | ||
install_linux_cross_compiler | ||
build_cross_compiled | ||
;; | ||
|
||
*) | ||
echo "Unsupported architecture" | ||
exit 1 | ||
;; | ||
esac |
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
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
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
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
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