Merge branch 'main' of github.com:Moosync/Moosync #775
Workflow file for this run
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 | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- 'dev' | |
- 'main' | |
jobs: | |
release: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-20.04] | |
env: | |
ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron | |
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v1 | |
- name: Install Node.js, NPM and Yarn | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '21' | |
cache: 'yarn' | |
- name: Get yarn cache | |
id: yarn-cache | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache Electron | |
uses: actions/cache@v2 | |
with: | |
path: ${{ github.workspace }}/.cache/electron | |
key: ${{ runner.os }}-electron-cache-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-electron-cache- | |
- name: Cache Electron-Builder | |
uses: actions/cache@v2 | |
with: | |
path: ${{ github.workspace }}/.cache/electron-builder | |
key: ${{ runner.os }}-electron-builder-cache-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-electron-builder-cache- | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: node_modules/librespot-node/native | |
- uses: maxim-lobanov/setup-xcode@v1 | |
if: ${{ runner.os == 'macOS' }} | |
with: | |
xcode-version: latest-stable | |
- if: ${{ runner.os == 'Linux' }} | |
run: sudo apt-get update -y && sudo apt-get install -y libarchive-tools rpm libasound2-dev libssl-dev libatomic1 | |
- name: Remove postinstall | |
run: | | |
sed -i -e 's/\"postinstall\":.*/\"postinstall\": \"patch-package\",/' package.json | |
shell: bash | |
- name: Set dev version | |
if: startsWith(github.ref, 'refs/heads/') | |
run: | | |
version=$(git describe --long --tags | sed 's/\([^-]*-g\)/r\1/') | |
sed -i -e "s/\"version\":.*/\"version\":\"${version:1}\",/" package.json | |
shell: bash | |
- name: yarn install | |
run: yarn install --immutable | |
- name: Set env BRANCH | |
run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV | |
- name: Set DEBUG_LOGGING | |
shell: bash | |
run: | | |
if [[ $BRANCH == 'dev' ]]; then | |
echo "DEBUG_LOGGING=true" >> "$GITHUB_ENV" | |
fi | |
- name: setup env | |
env: | |
YOUTUBECLIENTID: '${{ secrets.YOUTUBECLIENTID }}' | |
YOUTUBECLIENTSECRET: '${{ secrets.YOUTUBECLIENTSECRET }}' | |
LASTFMAPIKEY: '${{ secrets.LASTFMAPIKEY }}' | |
LASTFMSECRET: '${{ secrets.LASTFMSECRET }}' | |
SPOTIFYCLIENTID: '${{ secrets.SPOTIFYCLIENTID }}' | |
SPOTIFYCLIENTSECRET: '${{ secrets.SPOTIFYCLIENTSECRET }}' | |
FANARTTVAPIKEY: '${{ secrets.FANARTTVAPIKEY }}' | |
run: chmod +x setup_env.sh && . setup_env.sh | |
shell: bash | |
# - run: yarn test:unit | |
# - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:electron | |
# if: matrix.os == 'ubuntu-latest' | |
# - run: yarn test:electron | |
# if: matrix.os != 'ubuntu-latest' | |
- name: yarn electron:build | |
run: yarn electron:build | |
if: ${{ runner.os == 'Windows' }} | |
env: | |
CSC_LINK: ${{ secrets.WIN_CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }} | |
WIN_CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CI: true | |
- name: yarn electron:build | |
run: yarn electron:build | |
if: ${{ runner.os != 'Windows' }} | |
env: | |
CSC_LINK: ${{ secrets.MAC_CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CI: true | |
- uses: actions/upload-artifact@v3 | |
if: ${{ runner.os == 'Windows' }} | |
with: | |
name: Windows Exe | |
path: | | |
dist_electron/*.exe | |
dist_electron/latest*.yml | |
- uses: actions/upload-artifact@v3 | |
if: ${{ runner.os == 'macOS' }} | |
with: | |
name: MacOS Dmg | |
path: | | |
dist_electron/*.dmg | |
dist_electron/latest*.yml | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Linux AppImage | |
path: | | |
dist_electron/*.AppImage | |
dist_electron/latest*.yml | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Arch linux Pacman | |
path: | | |
dist_electron/*.pacman | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Linux tar.gz | |
path: dist_electron/*.tar.gz | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Linux Deb | |
path: dist_electron/*.deb |