Added support for dictionary outputs to nodejs script block #36
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 + Release | Staging | |
on: | |
push: | |
branches: | |
- 'staging' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
# Only run if the commit message contains the string [build] | |
if: contains(github.event.head_commit.message, '[build]') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Unit and integration tests | |
run: dotnet test | |
build: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
# Checkout the repository | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Get the commit number | |
- name: Get commit number | |
run: echo "COMMIT_NUMBER=$(git rev-list --count HEAD)" >> $GITHUB_ENV | |
# Read the version | |
- name: Read version | |
run: echo "VERSION=$(head -n 1 OpenBullet2.Web/version.txt)" >> $GITHUB_ENV | |
# Overwrite the contents of version.txt with $VERSION.$COMMIT_NUMBER | |
- name: Append commit number to version.txt | |
run: echo "${{ env.VERSION }}.${{ env.COMMIT_NUMBER }}" > OpenBullet2.Web/version.txt | |
# Do the same for the native client | |
- name: Append commit number to version.txt | |
run: echo "${{ env.VERSION }}.${{ env.COMMIT_NUMBER }}" > OpenBullet2.Native/version.txt | |
# Get the commit description | |
- name: Get commit description | |
run: | | |
echo 'COMMIT_DESCRIPTION<<EOF' >> $GITHUB_ENV | |
git log -1 --pretty=%b >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
# Read the version | |
- name: Read version again | |
run: echo "VERSION=$(head -n 1 OpenBullet2.Web/version.txt)" >> $GITHUB_ENV | |
# Build using docker | |
- name: Build using docker | |
run: docker build -t openbullet2-build -f Dockerfile.build . | |
# Extract files from the /app folder of the image into a zip | |
- name: Extract files from the image | |
run: | | |
docker run --name openbullet2-extract openbullet2-build echo "Extracting files" | |
docker cp openbullet2-extract:/app/web .web | |
docker cp openbullet2-extract:/app/native .native | |
docker cp openbullet2-extract:/app/updater .updater | |
docker rm openbullet2-extract | |
mkdir .release | |
cd .web | |
zip -r ../.release/OpenBullet2.Web.zip ./* | |
cd ../.native | |
zip -r ../.release/OpenBullet2.Native.zip ./* | |
cd .. | |
mv .updater/web/win-x64/OpenBullet2.Web.Updater.exe .release/ob2-web-updater-win-x64.exe | |
mv .updater/web/win-x86/OpenBullet2.Web.Updater.exe .release/ob2-web-updater-win-x86.exe | |
mv .updater/web/win-arm64/OpenBullet2.Web.Updater.exe .release/ob2-web-updater-win-arm64.exe | |
mv .updater/web/linux-x64/OpenBullet2.Web.Updater .release/ob2-web-updater-linux-x64 | |
mv .updater/web/linux-arm64/OpenBullet2.Web.Updater .release/ob2-web-updater-linux-arm64 | |
mv .updater/native/win-x64/OpenBullet2.Native.Updater.exe .release/ob2-native-updater-win-x64.exe | |
mv .updater/native/win-x86/OpenBullet2.Native.Updater.exe .release/ob2-native-updater-win-x86.exe | |
mv .updater/native/win-arm64/OpenBullet2.Native.Updater.exe .release/ob2-native-updater-win-arm64.exe | |
# Upload the files to the release | |
- name: Upload OpenBullet2 release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: '.release/*' | |
file_glob: true | |
release_name: ${{ env.VERSION }} | |
tag: ${{ env.VERSION }} | |
overwrite: false | |
prerelease: true | |
make_latest: true | |
# Show ONLY the commit description in the release (without) | |
body: | | |
This is a **STAGING** build. It might be unstable. Use at your own discretion. | |
Changelog: | |
${{ env.COMMIT_DESCRIPTION }} | |
- name: Notify new build on discord | |
if: success() | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
DISCORD_EMBEDS: | | |
[ | |
{ | |
"title": "New staging build", | |
"description": "Staging release **${{ env.VERSION }}** available", | |
"color": 5763719 | |
} | |
] | |
uses: Ilshidur/action-discord@master | |
- name: Setup upterm session | |
uses: lhotari/action-upterm@v1 | |
if: ${{ failure() }} | |
with: | |
## If no one connects after 5 minutes, shut down server. | |
wait-timeout-minutes: 5 |