Skip to content

publish bebop

publish bebop #165

Workflow file for this run

name: publish bebop
on:
push:
tags:
- "v*"
jobs:
build-compiler:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-22.04]
include:
- os: macos-latest
IDENTIFIER: osx
ARTIFACT: bebopc
- os: windows-latest
IDENTIFIER: win
ARTIFACT: bebopc.exe
- os: ubuntu-22.04
IDENTIFIER: linux
ARTIFACT: bebopc
BUILD_WASI: true
env:
CONFIGURATION: Release
BUILD_ARTIFACT_X86_64: ./bin/compiler/Release/publish/${{matrix.IDENTIFIER}}-x64/${{matrix.ARTIFACT}}
BUILD_ARTIFACT_ARM64: ./bin/compiler/Release/publish/${{matrix.IDENTIFIER}}-arm64/${{matrix.ARTIFACT}}
BUILD_ZIP_ARTIFACT_X86_64: ./bin/compiler/Release/publish/${{matrix.ARTIFACT}}-${{matrix.IDENTIFIER}}-x64.zip
BUILD_ZIP_ARTIFACT_ARM64: ./bin/compiler/Release/publish/${{matrix.ARTIFACT}}-${{matrix.IDENTIFIER}}-arm64.zip
BUILD_ARTIFACT_WASI: ./bin/compiler/Release/artifacts/wasi-wasm/AppBundle/${{matrix.ARTIFACT}}.wasm
steps:
- uses: actions/checkout@v4
- name: Get Environment Variables
id: dotenv
uses: falti/[email protected]
# ubuntu is the fastest OS to spin up and if one fails they all fail.
- if: matrix.os == 'ubuntu-22.04'
name: Check if Versions Synced
run: |
if [[ ! refs/tags/v${{ steps.dotenv.outputs.version }} =~ ^(${{ github.ref }})$ ]]; then
echo "${{ steps.dotenv.outputs.version }} is not the same as ${{ github.ref }}. Did you bump the .env file?" 1>&2
exit 1
fi
- if: matrix.os == 'ubuntu-22.04'
name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install clang zlib1g-dev libkrb5-dev libtinfo5
- if: matrix.os == 'ubuntu-22.04' && matrix.BUILD_WASI
name: Install WASI Dependencies
run: ./install-wasi.sh
working-directory: ./scripts/
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.x"
dotnet-quality: "preview"
- name: Build bebopc
run: |
dotnet restore
dotnet publish -c ${{env.CONFIGURATION}} -r ${{matrix.IDENTIFIER}}-x64 -p:ReleaseVersion=${{ steps.dotenv.outputs.version }} -p:PublishTrimmed=true -p:TrimMode=partial -p:PublishSingleFile=true --self-contained
dotnet publish -c ${{env.CONFIGURATION}} -r ${{matrix.IDENTIFIER}}-arm64 -p:ReleaseVersion=${{ steps.dotenv.outputs.version }} -p:PublishTrimmed=true -p:TrimMode=partial -p:PublishSingleFile=true --self-contained
working-directory: ./Compiler/
- if: matrix.os == 'ubuntu-22.04' && matrix.BUILD_WASI
name: Build bebopc for WASI
run: ./build-wasi.sh
working-directory: ./scripts/
- if: matrix.os == 'macos-latest'
name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
# The certificates in a PKCS12 file encoded as a base64 string
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
# The password used to import the PKCS12 file.
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
- if: matrix.os == 'macos-latest'
name: Install gon via HomeBrew for Code Signing and App Notarization
run: |
brew install mitchellh/gon/gon
- if: matrix.os == 'macos-latest'
name: Sign and zip macOS Binary
env:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
run: |
gon -log-level=trace -log-json ./gon-x64.json
unzip -j -o ./notarized-osx-x64.zip
rm -f ./notarized-osx-x64.zip
zip -j ${{env.BUILD_ZIP_ARTIFACT_X86_64}} ./bebopc
rm -f ./bebopc
gon -log-level=trace -log-json ./gon-arm64.json
unzip -j -o ./notarized-osx-arm64.zip
rm -f ./notarized-osx-arm64.zip
zip -j ${{env.BUILD_ZIP_ARTIFACT_ARM64}} ./bebopc
rm -f ./bebopc
- if: matrix.os == 'ubuntu-22.04'
name: ZIP Linux Build
run: |
zip -j ${{env.BUILD_ZIP_ARTIFACT_X86_64}} ${{env.BUILD_ARTIFACT_X86_64}}
zip -j ${{env.BUILD_ZIP_ARTIFACT_ARM64}} ${{env.BUILD_ARTIFACT_ARM64}}
- if: matrix.os == 'windows-latest'
name: ZIP Windows Build
shell: powershell
run: |
Compress-Archive -Path ${{env.BUILD_ARTIFACT_X86_64}} -DestinationPath ${{env.BUILD_ZIP_ARTIFACT_X86_64}}
Compress-Archive -Path ${{env.BUILD_ARTIFACT_ARM64}} -DestinationPath ${{env.BUILD_ZIP_ARTIFACT_ARM64}}
- name: Upload X86_64 Build
uses: actions/upload-artifact@v3
with:
name: ${{matrix.IDENTIFIER}}-x64
path: ${{env.BUILD_ZIP_ARTIFACT_X86_64}}
- name: Upload ARM64 Build
uses: actions/upload-artifact@v3
with:
name: ${{matrix.IDENTIFIER}}-arm64
path: ${{env.BUILD_ZIP_ARTIFACT_ARM64}}
- if: matrix.os == 'ubuntu-22.04' && matrix.BUILD_WASI
name: Upload WASI_WASM Build
uses: actions/upload-artifact@v3
with:
name: wasi-wasm
path: ${{env.BUILD_ARTIFACT_WASI}}
build-runtimes:
env:
NET_TEST_ROOT: ${{github.workspace}}/Laboratory/C#/Test
NET_RUNTIME_ROOT: ${{github.workspace}}/Runtime/C#
TS_TEST_ROOT: ${{github.workspace}}/Laboratory/TypeScript
TS_RUNTIME_ROOT: ${{github.workspace}}/Runtime/TypeScript
RUST_RUNTIME_ROOT: ${{github.workspace}}/Runtime/Rust
RUST_TEST_ROOT: ${{github.workspace}}/Laboratory/Rust
runs-on: ubuntu-22.04
needs: build-compiler
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v1
with:
node-version: "18.16.0" # LTS
- name: Get Environment Variables
id: dotenv
uses: falti/[email protected]
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.x"
dotnet-quality: "preview"
- name: Test .NET Runtime
run: |
dotnet run --project ../../../Compiler/ --include $(ls -p ../../Schemas/Valid/*.bop | tr '\n' ' ') build --generator "cs:../GeneratedTestCode/Output.g.cs,namespace=Bebop.Codegen"
dotnet test -c Release -f net7.0
working-directory: ${{env.NET_TEST_ROOT}}
- name: Build .NET Runtime
run: |
dotnet restore
dotnet build -c Release -p:ReleaseVersion=${{ steps.dotenv.outputs.version }}
working-directory: ${{env.NET_RUNTIME_ROOT}}
- name: Upload .NET Runtime Package
uses: actions/upload-artifact@v3
with:
name: bebop-runtime-cs-${{ steps.dotenv.outputs.version }}
path: ${{env.NET_RUNTIME_ROOT}}/bin/Release/bebop.${{ steps.dotenv.outputs.version }}.nupkg
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Cargo Login
run: cargo login ${{ secrets.CRATES_TOKEN }}
- name: Download Compiler Artifacts
uses: actions/download-artifact@v2
- name: Extract Compiler Artifacts
run: |
mkdir -p ${{github.workspace}}/bin/compiler/Debug/artifacts
unzip -j -o ./linux-x64/bebopc-linux-x64.zip -d ${{github.workspace}}/bin/compiler/Debug/artifacts
ls
# todo: depend on a different job
- name: Test Rust Runtime
run: cargo test
working-directory: ${{ env.RUST_RUNTIME_ROOT }}
- name: Test Rust Labratory
run: |
cargo check -p auto-testing
cargo test -p functionality-testing
working-directory: ${{ env.RUST_TEST_ROOT }}
- name: Package Rust Runtime
working-directory: ${{ env.RUST_RUNTIME_ROOT }}
run: |
sed 's/^version \?= \?.*/version = "${{ steps.dotenv.outputs.version }}"/' Cargo.toml > tmp
mv tmp Cargo.toml
cargo package --allow-dirty
- name: Upload Rust Runtime
uses: actions/upload-artifact@v3
with:
name: bebop-runtime-rust-${{steps.dotenv.outputs.version}}
path: ${{ env.RUST_RUNTIME_ROOT }}/target/package/bebop-${{ steps.dotenv.outputs.version }}.crate
- name: Build Typescript runtime
run: |
yarn install
yarn test
yarn build
working-directory: ${{env.TS_RUNTIME_ROOT}}
- name: Test TypeScript Runtime
run: |
yarn install
bash compile-schemas.sh
yarn test
working-directory: ${{env.TS_TEST_ROOT}}
- name: Pack TypeScript Runtime
run: |
jq '.version = "${{ steps.dotenv.outputs.version }}"' package.json > tmp && mv tmp package.json
yarn install
yarn pack
working-directory: ${{env.TS_RUNTIME_ROOT}}
- name: Upload TypeScript Runtime Package
uses: actions/upload-artifact@v3
with:
name: bebop-runtime-ts-${{ steps.dotenv.outputs.version }}
path: ${{env.TS_RUNTIME_ROOT}}/bebop-v${{ steps.dotenv.outputs.version }}.tgz
build-tools:
env:
TOOLS_ROOT: ${{github.workspace}}/Tools
BEBOPC_PATH: ${{github.workspace}}/Tools/bebopc
needs: build-compiler
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- uses: actions/setup-node@v1
with:
node-version: "18.16.0" # LTS
- name: Get Environment Variables
id: dotenv
uses: falti/[email protected]
- name: Download Compiler Artifacts
uses: actions/download-artifact@v2
- name: Extract Compiler Artifacts
run: |
ls
unzip -j -o ./win-x64/bebopc.exe-win-x64.zip -d ${{env.BEBOPC_PATH}}/windows/x64
unzip -j -o ./win-arm64/bebopc.exe-win-arm64.zip -d ${{env.BEBOPC_PATH}}/windows/arm64
unzip -j -o ./osx-x64/bebopc-osx-x64.zip -d ${{env.BEBOPC_PATH}}/macos/x64
unzip -j -o ./osx-arm64/bebopc-osx-arm64.zip -d ${{env.BEBOPC_PATH}}/macos/arm64
unzip -j -o ./linux-x64/bebopc-linux-x64.zip -d ${{env.BEBOPC_PATH}}/linux/x64
unzip -j -o ./linux-arm64/bebopc-linux-arm64.zip -d ${{env.BEBOPC_PATH}}/linux/arm64
cp ./wasi-wasm/bebopc.wasm ${{env.BEBOPC_PATH}}/wasi/wasm
- name: Build NuGet Package
run: bash build.sh ${{ steps.dotenv.outputs.version }}
working-directory: ${{env.TOOLS_ROOT}}/vs
- name: Upload Nuget Artifact
uses: actions/upload-artifact@v3
with:
name: bebop-tools-nuget-${{ steps.dotenv.outputs.version }}
path: ${{env.TOOLS_ROOT}}/vs/packages/bebop-tools.${{ steps.dotenv.outputs.version }}.nupkg
- name: Package Cargo Tools
working-directory: ${{env.TOOLS_ROOT}}/cargo
run: |
sed 's/^version \?= \?.*/version = "${{ steps.dotenv.outputs.version }}"/' Cargo.toml > tmp
mv tmp Cargo.toml
cargo package --allow-dirty
- name: Upload Cargo Tools
uses: actions/upload-artifact@v3
with:
name: bebop-tools-cargo-${{ steps.dotenv.outputs.version }}
path: ${{ env.TOOLS_ROOT }}/cargo/target/package/bebop-tools-${{ steps.dotenv.outputs.version }}.crate
- name: Copy Compiler Builds for NPM package
run: |
mkdir -p ${{env.TOOLS_ROOT}}/node/tools && cp -a ${{env.BEBOPC_PATH}}/. ${{env.TOOLS_ROOT}}/node/tools
- name: Build Tools NPM Package
run: |
jq '.version = "${{ steps.dotenv.outputs.version }}"' package.json > tmp && mv tmp package.json
yarn install
yarn pack
working-directory: ${{env.TOOLS_ROOT}}/node
- name: Upload NPM Artifact
uses: actions/upload-artifact@v3
with:
name: bebop-tools-npm-${{ steps.dotenv.outputs.version }}
path: ${{env.TOOLS_ROOT}}/node/bebop-tools-v${{ steps.dotenv.outputs.version }}.tgz
- name: Copy compiler builds for VSCode extension
run: |
mkdir -p ./vscode-bebop/compiler && cp -a ${{env.BEBOPC_PATH}}/. ./vscode-bebop/compiler
- name: Build VSCode extension
run: |
VERSION=$(echo ${{ steps.dotenv.outputs.version }} | sed 's/-.*//')
jq '.version = "'"$VERSION"'"' package.json > tmp && mv tmp package.json
npm install --global @vscode/vsce
yarn install
vsce package
if [[ $GITHUB_REF == refs/heads/vnext ]] || [[ $GITHUB_REF == refs/tags/*rc* ]] || [[ $GITHUB_REF == refs/tags/*alpha* ]] || [[ $GITHUB_REF == refs/tags/*beta* ]]; then
echo "Building pre-release package"
vsce package --pre-release
else
echo "Building standard package"
vsce package
fi
working-directory: ./vscode-bebop
- name: Upload VSCode artifact
uses: actions/upload-artifact@v3
with:
name: vscode-bebop
path: vscode-bebop/bebop-lang-*.vsix
publish-packages:
env:
RUST_RUNTIME_ROOT: ${{github.workspace}}/Runtime/Rust
TOOLS_ROOT: ${{github.workspace}}/Tools
runs-on: ubuntu-22.04
needs: [build-compiler, build-runtimes, build-tools]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v1
with:
node-version: "18.16.0" # LTS
registry-url: https://registry.npmjs.org/
- name: Get Environment Variables
id: dotenv
uses: falti/[email protected]
- id: release-info
name: Set Release Info
run: |
if [[ $GITHUB_REF == refs/heads/vnext ]] || [[ $GITHUB_REF == refs/tags/*rc* ]] || [[ $GITHUB_REF == refs/tags/*alpha* ]] || [[ $GITHUB_REF == refs/tags/*beta* ]]; then
echo "PRERELEASE=true" >> "$GITHUB_OUTPUT"
else
echo "PRERELEASE=false" >> "$GITHUB_OUTPUT"
fi
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: "8.0.x" # SDK Version to use; x will use the latest version of the 7.0 channel
include-prerelease: true
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Cargo Login
run: cargo login ${{ secrets.CRATES_TOKEN }}
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Publish .NET Tools
run: dotnet nuget push bebop-tools-nuget-${{ steps.dotenv.outputs.version }}/bebop-tools.${{ steps.dotenv.outputs.version }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: Publish .NET Runtime
run: dotnet nuget push bebop-runtime-cs-${{ steps.dotenv.outputs.version }}/bebop.${{ steps.dotenv.outputs.version }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: Publish Rust Tools
run: |
sed 's/^version \?= \?.*/version = "${{ steps.dotenv.outputs.version }}"/' Cargo.toml > tmp
mv tmp Cargo.toml
cargo publish --allow-dirty
working-directory: ${{env.TOOLS_ROOT}}/cargo
- name: Publish Rust Runtime
run: |
sed 's/^version \?= \?.*/version = "${{ steps.dotenv.outputs.version }}"/' Cargo.toml > tmp
mv tmp Cargo.toml
cargo publish --allow-dirty
working-directory: ${{env.RUST_RUNTIME_ROOT}}
- name: Publish NodeJS Tools
run: npm publish "./bebop-tools-npm-${{ steps.dotenv.outputs.version }}/bebop-tools-v${{ steps.dotenv.outputs.version }}.tgz" --access public ${{ steps.release-info.outputs.PRERELEASE == 'true' && '--tag next' || '' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
- name: Publish TypeScript Runtime
run: npm publish "./bebop-runtime-ts-${{ steps.dotenv.outputs.version }}/bebop-v${{ steps.dotenv.outputs.version }}.tgz" --access public ${{ steps.release-info.outputs.PRERELEASE == 'true' && '--tag next' || '' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
- name: Publish VSCode Extension
continue-on-error: true
run: |
npm install --global @vscode/vsce
VERSION=$(echo ${{ steps.dotenv.outputs.version }} | sed 's/-.*//')
if [[ $GITHUB_REF == refs/heads/vnext ]] || [[ $GITHUB_REF == refs/tags/*rc* ]] || [[ $GITHUB_REF == refs/tags/*alpha* ]] || [[ $GITHUB_REF == refs/tags/*beta* ]]; then
echo "Publishing vscode pre-release package"
vsce publish --pre-release --packagePath ./vscode-bebop/bebop-lang-$VERSION.vsix -p ${{ secrets.VSCE_TOKEN }}
else
echo "Publishing vscode standard package"
vsce publish --packagePath ./vscode-bebop/bebop-lang-$VERSION.vsix -p ${{ secrets.VSCE_TOKEN }}
fi
- name: Publish Open VSX Extension
continue-on-error: true
run: |
npm i -g ovsx
VERSION=$(echo ${{ steps.dotenv.outputs.version }} | sed 's/-.*//')
if [[ $GITHUB_REF == refs/heads/vnext ]] || [[ $GITHUB_REF == refs/tags/*rc* ]] || [[ $GITHUB_REF == refs/tags/*alpha* ]] || [[ $GITHUB_REF == refs/tags/*beta* ]]; then
echo "Publishing ovsx pre-release package"
npx ovsx publish --pre-release ./vscode-bebop/bebop-lang-$VERSION.vsix -p ${{ secrets.OPENVSX }}
else
echo "Publishing ovsx standard package"
npx ovsx publish ./vscode-bebop/bebop-lang-$VERSION.vsix -p ${{ secrets.OPENVSX }}
fi
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Bebop ${{ github.ref }}
draft: false
prerelease: ${{ steps.release-info.outputs.PRERELEASE == 'true' }}
- name: Upload Compiler for Windows x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./win-x64/bebopc.exe-win-x64.zip
asset_name: bebopc-windows-x64.zip
asset_content_type: application/zip
- name: Upload Compiler for Windows ARM64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./win-arm64/bebopc.exe-win-arm64.zip
asset_name: bebopc-windows-arm64.zip
asset_content_type: application/zip
- name: Upload Compiler for Mac x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./osx-x64/bebopc-osx-x64.zip
asset_name: bebopc-macos-x64.zip
asset_content_type: application/zip
- name: Upload Compiler for Mac ARM64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./osx-arm64/bebopc-osx-arm64.zip
asset_name: bebopc-macos-arm64.zip
asset_content_type: application/zip
- name: Upload Compiler for Linux x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./linux-x64/bebopc-linux-x64.zip
asset_name: bebopc-linux-x64.zip
asset_content_type: application/zip
- name: Upload Compiler for Linux ARM64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./linux-arm64/bebopc-linux-arm64.zip
asset_name: bebopc-linux-arm64.zip
asset_content_type: application/zip
- name: Upload Compiler for WASM
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./wasi-wasm/bebopc.wasm
asset_name: bebopc.wasm
asset_content_type: application/wasm