Skip to content

v2.1.8

v2.1.8 #3682

Workflow file for this run

name: Build Amethyst
on:
push:
paths-ignore:
- "**/*.md"
- 'src/renderer/locales/**'
pull_request:
paths-ignore:
- "**/*.md"
- 'src/renderer/locales/**'
jobs:
test:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: 20.17.0
cache: "yarn"
- name: Install gcc dependencies
run: sudo apt update && sudo apt install gcc-multilib g++-multilib libvips
- name: Install Dependencies
run: yarn install
- name: Install Test Dependencies
run: yarn playwright install
- name: Run tests
run: yarn test
lint:
name: Check for lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: 20.17.0
cache: "yarn"
- name: Install gcc dependencies
run: sudo apt update && sudo apt install gcc-multilib g++-multilib libvips
- name: Install Dependencies
run: yarn install
- name: Run eslint
run: yarn lint
build-windows:
needs: [test, lint]
name: Build Windows
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: 20.17.0
cache: "yarn"
- name: Install Dependencies
run: yarn install
- name: Build Amethyst
run: yarn package
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifact-windows
path: |
release/build/*.yml
release/build/*.yaml
release/build/*.exe*
build-macos:
needs: [test, lint]
name: Build MacOS
runs-on: macos-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: 20.17.0
cache: "yarn"
- name: Install Dependencies
run: yarn install
- name: Build Amethyst
run: USE_HARD_LINKS=false yarn package
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifact-macos
path: |
release/build/*.yml
release/build/*.dmg
release/build/*.dmg.*
release/build/*.zip
release/build/*.zip.*
build-linux:
needs: [test, lint]
name: Build Linux - ${{ matrix.target }} - ${{ matrix.arch }}
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
target: [AppImage, deb, snap, rpm, pacman]
arch: [x64, arm64]
exclude:
- target: snap
arch: arm64 # Snapcraft doesn't support cross-compiling to ARM well without emulation
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: 20.17.0
cache: "yarn"
- name: Install common Linux dependencies
run: |
sudo apt update
sudo apt install -y libvips libvips-dev libvips-tools libarchive-tools
- name: Install target-specific dependencies
run: |
case "${{ matrix.target }}" in
snap)
sudo apt install -y snapd
sudo snap install snapcraft --classic
sudo snap install multipass --beta --classic
;;
rpm)
sudo apt install -y rpm
;;
pacman)
sudo apt install -y fakeroot
;;
esac
- name: Install Node.js Dependencies
run: yarn install
- name: Build Amethyst for ${{ matrix.target }} - ${{ matrix.arch }}
run: |
yarn build
yarn run electron-builder --publish never --linux ${{ matrix.target }} --${{ matrix.arch }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifact-linux-${{ matrix.target }}-${{ matrix.arch }}
path: |
release/build/*.yml
release/build/*.yaml
release/build/*.AppImage
release/build/*.rpm
release/build/*.deb
release/build/*.pacman
release/build/*.snap
build-android:
needs: [test, lint]
name: Build Android
runs-on: ubuntu-latest
env:
KEYSTORE_PATH: './release-key.jks'
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-java@v4
with:
distribution: oracle
java-version: '21'
- uses: actions/setup-node@v4
with:
node-version: 20.17.0
cache: "yarn"
- name: Reconstruct keystore from base64
run: echo "${{ secrets.JKS_BASE64 }}" | base64 -d > src/android/app/release-key.jks
- name: List android app directory
run: ls src/android/app
- name: Install Dependencies
run: yarn install
- name: Make gradlew executable
run: chmod +x ./src/android/gradlew
- name: Generate icons from assets
run: yarn gen:android-icons
- name: Build Amethyst
run: yarn build:android
- name: List APK output directory
run: ls -R src/android/app/build/outputs/apk/
- name: Rename APK with version and move
run: |
VERSION=$(jq -r .version package.json)
mkdir -p ./release/build
mv ./src/android/app/build/outputs/apk/release/app-release.apk "./release/build/amethyst-v${VERSION}.apk"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifact-android
path: |
release/build/*.apk
release-to-aur-git:
name: Release to AUR -git
runs-on: ubuntu-latest
# If we can't build, we should not release to AUR
needs: [build-linux]
if: needs.build-linux.result == 'success' && github.ref == 'refs/heads/master' && github.repository_owner == 'Geoxor'
env:
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
COMMIT_LONGHASH: ${{ github.sha }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to AUR
run: |
mkdir -p ~/.ssh
echo "$AUR_SSH_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "Host aur.archlinux.org" >> ~/.ssh/config
echo " IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
echo " StrictHostKeyChecking no" >> ~/.ssh/config
echo " User aur" >> ~/.ssh/config
- name: Publish to AUR
run: |
PACKAGE_VERSION=$(cat package.json | jq ".version" | sed -e 's/\"//g')
COMMIT_SHORTHASH=$(echo $COMMIT_LONGHASH | cut -c1-7)
git clone ssh://aur@aur.archlinux.org/amethyst-player-git.git
cd amethyst-player-git
git checkout master
PKG_REVISION=$(grep -oP 'pkgver=v.*r\K.*' PKGBUILD | grep -oP "\d+" | head -n 1)
PKG_NEXT_REVISION=$((PKG_REVISION + 1))
PKG_VERSION=v${PACKAGE_VERSION}.r${PKG_NEXT_REVISION}.g${COMMIT_SHORTHASH}
git config user.email "github-actions@github.com"
git config user.name "GitHub Actions"
sed -i -E "s/pkgver=.*/pkgver=$PKG_VERSION/g" PKGBUILD
sed -i -E "s/pkgver = .*/pkgver = $PKG_VERSION/g" .SRCINFO
git add PKGBUILD .SRCINFO
git commit -m "Update to $PKG_VERSION (Git ref: $COMMIT_LONGHASH)"
git push origin HEAD:refs/heads/master
publish-releases:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build-windows, build-macos, build-linux, build-android]
name: Publish releases
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
pattern: artifact-*
merge-multiple: true
- name: Post Releases
uses: ncipollo/release-action@v1
with:
artifacts: "*"
update-download-links:
needs: [publish-releases]
name: Update download links
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.17.0
cache: "yarn"
- name: Install dependencies
run: yarn
- name: Update download links
run: yarn update-download-links
- name: Commit and push changes as Geoxor
env:
GITHUB_TOKEN: ${{ secrets.GEOXOR_PERSONAL_GITHUB_TOKEN }}
run: |
git config user.name "Geoxor"
git config user.email "34042825+Geoxor@users.noreply.github.com"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
git add .
git diff --quiet && git diff --staged --quiet || git commit -m "chore: update download links to latest release"
git push
update-homebrew-cask:
needs: [publish-releases]
name: Update homebrew cask
runs-on: ubuntu-latest
steps:
- name: Checkout Amethyst repo
uses: actions/checkout@v4
- name: Read version from package.json
id: version
run: |
echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
- name: Download DMGs and calculate SHA256
id: hashes
run: |
VERSION=${{ steps.version.outputs.version }}
INTEL_URL="https://github.com/Geoxor/Amethyst/releases/download/v${VERSION}/Amethyst-${VERSION}.dmg"
ARM_URL="https://github.com/Geoxor/Amethyst/releases/download/v${VERSION}/Amethyst-${VERSION}-arm64.dmg"
curl -L -o amethyst-intel.dmg "$INTEL_URL"
curl -L -o amethyst-arm.dmg "$ARM_URL"
INTEL_SHA=$(shasum -a 256 amethyst-intel.dmg | awk '{print $1}')
ARM_SHA=$(shasum -a 256 amethyst-arm.dmg | awk '{print $1}')
echo "intel_sha=$INTEL_SHA" >> $GITHUB_OUTPUT
echo "arm_sha=$ARM_SHA" >> $GITHUB_OUTPUT
- name: Clone Homebrew Tap Repo
run: |
git config --global user.name "Geoxor"
git config --global user.email "34042825+Geoxor@users.noreply.github.com"
git clone https://Geoxor:${{ secrets.GEOXOR_PERSONAL_GITHUB_TOKEN }}@github.com/Geoxor/homebrew-amethyst.git cask-repo
- name: Update version and SHA256s in cask
run: |
cd cask-repo/Casks/a
# Replace version
sed -i 's/version "[0-9.]*"/version "${{ steps.version.outputs.version }}"/' amethyst-player.rb
# Replace ARM and Intel SHA blocks
sed -i '/on_arm do/,/end/ s|sha256 .*|sha256 "${{ steps.hashes.outputs.arm_sha }}"|' amethyst-player.rb
sed -i '/on_intel do/,/end/ s|sha256 .*|sha256 "${{ steps.hashes.outputs.intel_sha }}"|' amethyst-player.rb
- name: Commit and push changes
run: |
cd cask-repo
git add Casks/a/amethyst-player.rb
git commit -m "chore: bump version to v${{ steps.version.outputs.version }}" || echo "No changes to commit"
git push https://Geoxor:${{ secrets.GEOXOR_PERSONAL_GITHUB_TOKEN }}@github.com/Geoxor/homebrew-amethyst.git HEAD:main