Skip to content

Merge branch 'staging' #15

Merge branch 'staging'

Merge branch 'staging' #15

Workflow file for this run

name: Build + Release
on:
push:
branches:
- 'master'
jobs:
test:
runs-on: ubuntu-latest
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
# Only run if the commit message contains the string [build]
if: contains(github.event.head_commit.message, '[build]')
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Read the version
- name: Read version
run: echo "VERSION=$(cat 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: true
prerelease: false
make_latest: true
# Show ONLY the commit description in the release (without)
body: |
This is a **RELEASE** build.
Please refer to [this guide](https://discourse.openbullet.dev/t/how-to-download-and-start-openbullet-2/29) for the download instructions.
- name: Notify new build on discord
if: success()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_EMBEDS: |
[
{
"title": "New release build",
"description": "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
docker:
name: Push Docker image to Docker Hub
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# Read the version
- name: Read version
run: echo "VERSION=$(cat OpenBullet2.Web/version.txt)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
tags: openbullet/openbullet2:latest,openbullet/openbullet2:${{ env.VERSION }}