Skip to content

wip: these feedbacks can do variables now too #3757

wip: these feedbacks can do variables now too

wip: these feedbacks can do variables now too #3757

Workflow file for this run

name: Build binaries
on: [push]
jobs:
linux64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
- name: Cache build sources
uses: actions/cache@v3
with:
path: .cache
key: linux-x64-build-cache
- name: build & package
run: |
# try and avoid timeout errors
yarn config set network-timeout 100000 -g
yarn update
yarn zx tools/build/complete.mjs
# manually tar it, to preserve the symlinks
cd electron-output
mv linux-unpacked companion-x64
tar -cvzf companion-x64.tar.gz companion-x64
env:
CI: 1
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
USE_HARD_LINKS: false
- name: Determine files to upload
id: filenames
shell: bash
run: |
VERSION=$(cat ./dist/BUILD)
echo "sourcename=electron-output/companion-x64.tar.gz" >> $GITHUB_OUTPUT
echo "targetname=companion-linux-x64-${VERSION}.tar.gz" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}" >> $GITHUB_OUTPUT
- name: Upload build
id: upload
uses: bitfocus/actions/upload-and-notify@main
with:
long-version: ${{ steps.filenames.outputs.longversion }}
beta-branch: beta
dev-branch: develop
source-filename: ${{ steps.filenames.outputs.sourcename }}
destination-filename: ${{ steps.filenames.outputs.targetname }}
s3-host: ${{ secrets.S3_HOST }}
s3-bucket: ${{ secrets.S3_BUCKET }}/companion
s3-access-key: ${{ secrets.S3_KEY }}
s3-secret-key: ${{ secrets.S3_SECRET }}
api-product: companion
api-target: 'linux-tgz'
api-secret: ${{ secrets.BITFOCUS_API_PROJECT_SECRET }}
- name: Report docker build is needed
if: ${{ steps.upload.outputs.branch }}
uses: actions/upload-artifact@v3
with:
name: do-docker-build
path: dist/BUILD
linux-arm64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
- name: Cache build sources
uses: actions/cache@v3
with:
path: .cache
key: linux-arm64-build-cache
- name: build & package
run: |
# try and avoid timeout errors
yarn config set network-timeout 100000 -g
yarn update
yarn zx tools/build/complete.mjs linux-arm64
# manually tar it, to preserve the symlinks
cd electron-output
mv linux-arm64-unpacked companion-arm64
tar -cvzf companion-arm64.tar.gz companion-arm64
env:
CI: 1
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SKIP_LAUNCH_CHECK: true
USE_HARD_LINKS: false
- name: Determine files to upload
id: filenames
shell: bash
run: |
VERSION=$(cat ./dist/BUILD)
echo "sourcename=electron-output/companion-arm64.tar.gz" >> $GITHUB_OUTPUT
echo "targetname=companion-linux-arm64-${VERSION}.tar.gz" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}" >> $GITHUB_OUTPUT
- name: Upload build
uses: bitfocus/actions/upload-and-notify@main
with:
long-version: ${{ steps.filenames.outputs.longversion }}
beta-branch: beta
dev-branch: develop
source-filename: ${{ steps.filenames.outputs.sourcename }}
destination-filename: ${{ steps.filenames.outputs.targetname }}
s3-host: ${{ secrets.S3_HOST }}
s3-bucket: ${{ secrets.S3_BUCKET }}/companion
s3-access-key: ${{ secrets.S3_KEY }}
s3-secret-key: ${{ secrets.S3_SECRET }}
api-product: companion
api-target: 'linux-arm64-tgz'
api-secret: ${{ secrets.BITFOCUS_API_PROJECT_SECRET }}
osx:
runs-on: macos-11
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
- name: Cache build sources
uses: actions/cache@v3
with:
path: .cache
key: macos-x64-build-cache
- name: build & package
run: |
# try and avoid timeout errors
yarn config set network-timeout 100000 -g
yarn update
yarn zx tools/build/complete.mjs
env:
CI: 1
CSC_LINK: ${{ secrets.OSX_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.OSX_CSC_KEY_PASSWORD }}
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
USE_HARD_LINKS: false
- name: Determine files to upload
id: filenames
shell: bash
run: |
VERSION=$(cat ./dist/BUILD)
echo "sourcename=electron-output/companion-mac-x64.dmg" >> $GITHUB_OUTPUT
echo "targetname=companion-mac-x64-${VERSION}.dmg" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}" >> $GITHUB_OUTPUT
- name: Upload build
uses: bitfocus/actions/upload-and-notify@main
with:
long-version: ${{ steps.filenames.outputs.longversion }}
beta-branch: beta
dev-branch: develop
source-filename: ${{ steps.filenames.outputs.sourcename }}
destination-filename: ${{ steps.filenames.outputs.targetname }}
s3-host: ${{ secrets.S3_HOST }}
s3-bucket: ${{ secrets.S3_BUCKET }}/companion
s3-access-key: ${{ secrets.S3_KEY }}
s3-secret-key: ${{ secrets.S3_SECRET }}
api-product: companion
api-target: 'mac-intel'
api-secret: ${{ secrets.BITFOCUS_API_PROJECT_SECRET }}
osx-arm64:
runs-on: macos-11
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
- name: Cache build sources
uses: actions/cache@v3
with:
path: .cache
key: macos-arm64-build-cache
- name: yarn update
run: |
# try and avoid timeout errors
yarn config set network-timeout 100000 -g
yarn update
env:
CI: 1
- name: build & package
run: |
yarn zx tools/build/complete.mjs darwin-arm64
env:
CI: 1
CSC_LINK: ${{ secrets.OSX_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.OSX_CSC_KEY_PASSWORD }}
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
USE_HARD_LINKS: false
SKIP_LAUNCH_CHECK: true
- name: Determine files to upload
id: filenames
shell: bash
run: |
VERSION=$(cat ./dist/BUILD)
echo "sourcename=electron-output/companion-mac-arm64.dmg" >> $GITHUB_OUTPUT
echo "targetname=companion-mac-arm64-${VERSION}.dmg" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}" >> $GITHUB_OUTPUT
- name: Upload build
uses: bitfocus/actions/upload-and-notify@main
with:
long-version: ${{ steps.filenames.outputs.longversion }}
beta-branch: beta
dev-branch: develop
source-filename: ${{ steps.filenames.outputs.sourcename }}
destination-filename: ${{ steps.filenames.outputs.targetname }}
s3-host: ${{ secrets.S3_HOST }}
s3-bucket: ${{ secrets.S3_BUCKET }}/companion
s3-access-key: ${{ secrets.S3_KEY }}
s3-secret-key: ${{ secrets.S3_SECRET }}
api-product: companion
api-target: 'mac-arm'
api-secret: ${{ secrets.BITFOCUS_API_PROJECT_SECRET }}
win64:
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
- name: Cache build sources
uses: actions/cache@v3
with:
path: .cache
key: windows-x64-build-cache
- name: build & package
shell: bash
run: |
# try and avoid timeout errors
yarn config set network-timeout 100000 -g
# This fixes it somehow, and without it we get no logs from any shell scripts which are run
yarn config set script-shell bash
yarn update
# zx needs this to be unset..
yarn config set script-shell ''
yarn zx tools/build/complete.mjs
env:
CI: 1
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Determine files to upload
id: filenames
shell: bash
run: |
VERSION=$(cat ./dist/BUILD)
echo "sourcename=electron-output/companion-win64.exe" >> $GITHUB_OUTPUT
echo "targetname=companion-win64-${VERSION}.exe" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}" >> $GITHUB_OUTPUT
- name: Upload build
uses: bitfocus/actions/upload-and-notify@main
with:
long-version: ${{ steps.filenames.outputs.longversion }}
beta-branch: beta
dev-branch: develop
source-filename: ${{ steps.filenames.outputs.sourcename }}
destination-filename: ${{ steps.filenames.outputs.targetname }}
s3-host: ${{ secrets.S3_HOST }}
s3-bucket: ${{ secrets.S3_BUCKET }}/companion
s3-access-key: ${{ secrets.S3_KEY }}
s3-secret-key: ${{ secrets.S3_SECRET }}
api-product: companion
api-target: 'win-x64'
api-secret: ${{ secrets.BITFOCUS_API_PROJECT_SECRET }}
docker-image:
runs-on: ubuntu-latest
needs:
- linux64
- linux-arm64
env:
IMAGE_NAME: companion
steps:
- name: Check if build is required
id: build-check
uses: xSAVIKx/artifact-exists-action@v0
with:
name: do-docker-build
- uses: actions/checkout@v3
if: '${{ steps.build-check.outputs.exists }}'
- uses: actions/download-artifact@v3
if: '${{ steps.build-check.outputs.exists }}'
with:
name: do-docker-build
- name: Determine target image name
if: '${{ steps.build-check.outputs.exists }}'
id: image-name
run: |
BUILD_VERSION=$(cat BUILD)
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
IMAGES=
IMAGES="$IMAGE_ID:$VERSION,$IMAGES"
# IMAGES="$IMAGE_ID:$BUILD_VERSION,$IMAGES" TODO - this would be nice to have, but the version needs making docker-tag safe first
# debug output
echo images $IMAGES
echo "images=$IMAGES" >> $GITHUB_OUTPUT
echo "build_version=$BUILD_VERSION" >> $GITHUB_OUTPUT
- name: Set up QEMU
if: ${{ steps.image-name.outputs.images }}
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
if: ${{ steps.image-name.outputs.images }}
uses: docker/setup-buildx-action@v2
- name: Login to registry
if: ${{ steps.image-name.outputs.images }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
if: ${{ steps.image-name.outputs.images }}
with:
context: .
file: Dockerfile.prebuild
platforms: linux/amd64,linux/arm64/v8
push: true
tags: ${{ steps.image-name.outputs.images }}
build-args: |
build_name=${{ steps.image-name.outputs.build_version }}