Skip to content

Commit

Permalink
20241107: Build and release process improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
queenkjuul authored Nov 7, 2024
1 parent c4598af commit 00a2936
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 51 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,22 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
node-version-file: './server/.nvmrc'
cache-dependency-path: 'server/package-lock.json'
- name: version
uses: jozsefsallai/[email protected]
- uses: jozsefsallai/[email protected]
with:
path: server/package.json
- uses: benjlevesque/[email protected]
- name: install
run: npm ci
- run: npm ci
working-directory: ./server
- name: build
run: npm run build:linux:x64;npm run build:linux:arm64
working-directory: ./server
- name: archive
run: for platform in "linux/arm64" "linux/x64";do tar -cvzf spotify97-server-$(echo $platform | tr "/" "-")-$(npm pkg get version | tr -d '"').tar.gz $platform;done;ls -la
run: for platform in "linux/arm64" "linux/x64";do cd $platform; tar -cvzf ../../spotify97-server-$(echo $platform | tr "/" "-")-$(npm pkg get version | tr -d '"').tar.gz .;cd ../../;done;ls -la
working-directory: ./server/dist
- name: upload
uses: appleboy/[email protected]
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,28 @@ on:
jobs:
build:

runs-on: ubuntu-latest
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
runs-on: macos-latest
defaults:
run:
working-directory: ./server

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
node-version-file: './server/.nvmrc'
cache-dependency-path: 'server/package-lock.json'
- name: version
uses: jozsefsallai/[email protected]
- uses: jozsefsallai/[email protected]
with:
path: server/package.json
- uses: benjlevesque/[email protected]
- name: install
run: npm ci
- run: npm ci
working-directory: ./server
- name: build
run: npm run build:macos
- run: npm run build:macos
working-directory: ./server
- name: archive
run: for platform in "macos/x64";do tar -cvzf spotify97-server-$(echo $platform | tr "/" "-")-$(npm pkg get version | tr -d '"').tar.gz $platform;done;ls -la
run: for platform in "macos/x64";do cd $platform; tar -cvzf ../../spotify97-server-$(echo $platform | tr "/" "-")-$(npm pkg get version | tr -d '"').tar.gz .;cd ../../;done;ls -la
working-directory: ./server/dist
- name: upload
uses: appleboy/[email protected]
Expand Down
20 changes: 6 additions & 14 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,24 @@ jobs:
build:

runs-on: windows-latest
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
defaults:
run:
working-directory: ./server

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
node-version-file: './server/.nvmrc'
cache-dependency-path: 'server/package-lock.json'
- name: version
uses: jozsefsallai/[email protected]
- uses: jozsefsallai/[email protected]
with:
path: server/package.json
- uses: benjlevesque/[email protected]
- name: install
run: npm ci
- run: npm ci
working-directory: ./server
- name: build
run: npm run build:windows
- run: npm run build:windows
working-directory: ./server
- name: archive
run: Compress-Archive -LiteralPath win -DestinationPath spotify97-server-win64-${{ env.PACKAGE_VERSION }}.zip;dir win;dir
Expand All @@ -50,13 +44,11 @@ jobs:
needs: "build"
steps:
- uses: actions/checkout@v4
- name: version
uses: jozsefsallai/[email protected]
- uses: jozsefsallai/[email protected]
with:
path: server/package.json
- uses: benjlevesque/[email protected]
- name: download
uses: actions/download-artifact@v4
- uses: actions/download-artifact@v4
with:
name: windows-binary-${{ env.SHA }}
path: .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jekyll-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll with GitHub Pages dependencies preinstalled
name: Deploy Spotify97 GitHub Pages Site

on:
# Runs on pushes targeting the default branch
Expand Down
64 changes: 48 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
name: Release Build

# If tag matching current package.json version exists, that tag will be built
# else, it will be created using the commit provided as the input
# on pushing a new tag, it should build that tag and release it
# tag used to generate release is ALWAYS the package.json version so keep that in mind
on:
workflow_dispatch:
inputs:
# tag:
# description: "tag to release"
# required: true
# type: string
commit:
description: "commit or branch to release"
required: true
default: "main"
required: false
type: string
push:
tags:
Expand All @@ -20,7 +19,6 @@ jobs:
windows:
runs-on:
windows-latest
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
defaults:
run:
working-directory: ./server
Expand All @@ -46,10 +44,48 @@ jobs:
with:
name: spotify97-server-win64-${{ env.PACKAGE_VERSION }}-release
path: server/dist/spotify97-server-win64-${{ env.PACKAGE_VERSION }}-release.zip
nix:
macos:
runs-on:
macos-latest
defaults:
run:
working-directory: ./server
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: "npm"
node-version-file: "./server/.nvmrc"
cache-dependency-path: "server/package-lock.json"
- uses: jozsefsallai/[email protected]
with:
path: server/package.json
- uses: benjlevesque/[email protected]
- run: npm ci
working-directory: ./server
- run: npm run build:macos
working-directory: ./server
- name: archive
run: for platform in "macos/x64";do cd $platform;tar -cvzf ../../spotify97-server-$(echo $platform | tr "/" "-")-$(npm pkg get version | tr -d '"')-release.tar.gz .;cd ../../;done;ls -la
working-directory: ./server/dist
- uses: actions/upload-artifact@v4
with:
name: spotify97-server-macos-x64-${{ env.PACKAGE_VERSION }}-release
path: server/dist/spotify97-server-macos-x64-${{ env.PACKAGE_VERSION }}-release.tar.gz
- name: upload
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
port: ${{ secrets.PORT }}
key: ${{ secrets.KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
source: "server/dist/spotify97-server-linux-arm64-${{env.PACKAGE_VERSION}}-release.tar.gz,server/dist/spotify97-server-linux-x64-${{env.PACKAGE_VERSION}}-release.tar.gz,server/dist/spotify97-server-macos-x64-${{ env.PACKAGE_VERSION }}-release.tar.gz"
target: /srv/www/public/spotifyclient97/server/${{ env.PACKAGE_VERSION }}/release/
strip_components: 2
linux:
runs-on:
ubuntu-latest
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
defaults:
run:
working-directory: ./server
Expand All @@ -69,7 +105,7 @@ jobs:
- run: npm run build:all
working-directory: ./server
- name: archive
run: for platform in "linux/arm64" "linux/x64" "macos/x64";do cd $platform;tar -cvzf ../../spotify97-server-$(echo $platform | tr "/" "-")-$(npm pkg get version | tr -d '"')-release.tar.gz .;cd ../../;done;ls -la
run: for platform in "linux/arm64" "linux/x64";do cd $platform;tar -cvzf ../../spotify97-server-$(echo $platform | tr "/" "-")-$(npm pkg get version | tr -d '"')-release.tar.gz .;cd ../../;done;ls -la
working-directory: ./server/dist
- uses: actions/upload-artifact@v4
with:
Expand All @@ -79,10 +115,6 @@ jobs:
with:
name: spotify97-server-linux-arm64-${{ env.PACKAGE_VERSION }}-release
path: server/dist/spotify97-server-linux-arm64-${{ env.PACKAGE_VERSION }}-release.tar.gz
- uses: actions/upload-artifact@v4
with:
name: spotify97-server-macos-x64-${{ env.PACKAGE_VERSION }}-release
path: server/dist/spotify97-server-macos-x64-${{ env.PACKAGE_VERSION }}-release.tar.gz
- name: upload
uses: appleboy/[email protected]
with:
Expand All @@ -91,12 +123,12 @@ jobs:
port: ${{ secrets.PORT }}
key: ${{ secrets.KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
source: "server/dist/spotify97-server-linux-arm64-${{env.PACKAGE_VERSION}}-release.tar.gz,server/dist/spotify97-server-linux-x64-${{env.PACKAGE_VERSION}}-release.tar.gz,server/dist/spotify97-server-macos-x64-${{ env.PACKAGE_VERSION }}-release.tar.gz"
source: "server/dist/spotify97-server-linux-arm64-${{env.PACKAGE_VERSION}}-release.tar.gz,server/dist/spotify97-server-linux-x64-${{env.PACKAGE_VERSION}}-release.tar.gz"
target: /srv/www/public/spotifyclient97/server/${{ env.PACKAGE_VERSION }}/release/
strip_components: 2
publish:
runs-on: ubuntu-latest
needs: ["windows", "nix"]
needs: ["windows", "linux", "macos"]
permissions:
contents: write
steps:
Expand Down

0 comments on commit 00a2936

Please sign in to comment.