Skip to content

Commit

Permalink
Merge pull request #196 from holochain-apps/ci/automated-release-builds
Browse files Browse the repository at this point in the history
Ci/automated release builds
  • Loading branch information
mattyg authored Nov 4, 2024
2 parents c5d5877 + cc27e63 commit 5da74db
Show file tree
Hide file tree
Showing 5 changed files with 387 additions and 83 deletions.
166 changes: 166 additions & 0 deletions .github/actions/extend-space-macos/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# Extends disk space on github hosted runners

name: "Extend space macOS"
description: "Teases out as much free space as possible"

runs:
using: "composite"
steps:
- name: Extend space macos
shell: "bash"
run: |
set -e
set -u
set -o pipefail
# Uninstall Gems.
for gem in $(gem list --no-versions | grep -v \
-e 'bigdecimal' \
-e 'CFPropertyList' \
-e 'cmath' \
-e 'csv' \
-e 'date' \
-e 'dbm' \
-e 'did_you_mean' \
-e 'e2mmap' \
-e 'etc' \
-e 'fcntl' \
-e 'fiddle' \
-e 'fileutils' \
-e 'forwardable' \
-e 'io-console' \
-e 'ipaddr' \
-e 'irb' \
-e 'json' \
-e 'libxml-ruby' \
-e 'logger' \
-e 'matrix' \
-e 'minitest' \
-e 'mutex_m' \
-e 'net-telnet' \
-e 'nokogiri' \
-e 'openssl' \
-e 'ostruct' \
-e 'power_assert' \
-e 'prime' \
-e 'psych' \
-e 'rake' \
-e 'rexml' \
-e 'rdoc' \
-e 'rbs' \
-e 'rss' \
-e 'scanf' \
-e 'shell' \
-e 'sqlite3' \
-e 'stringio' \
-e 'strscan' \
-e 'sync' \
-e 'test-unit' \
-e 'thwait' \
-e 'tracer' \
-e 'typeprof' \
-e 'webrick' \
-e 'xmlrpc' \
-e 'zlib' \
); do
sudo gem uninstall --force --all --ignore-dependencies --executables "$gem"
done
# Uninstall Homebrew.
brew update
sudo rm -rf /usr/local/miniconda &
rm -rf /usr/local/lib/node_modules &
rm -f /usr/local/bin/terminal-notifier
rm -f /usr/local/bin/change_hostname.sh
rm -f /usr/local/bin/azcopy
if which brew &>/dev/null; then
eval "$(brew list --formula | xargs -I% echo 'brew uninstall --formula --force --ignore-dependencies "%" &')"
eval "$(brew list --cask | xargs -I% echo '{ brew uninstall --cask --force "%"; brew uninstall --cask --zap --force "%"; } &')"
brew uninstall --cask --zap --force dotnet &
brew uninstall --cask --zap --force adoptopenjdk/openjdk/adoptopenjdk8 &
brew uninstall --cask --zap --force mono-mdk &
brew uninstall --cask --zap --force xamarin-android &
brew uninstall --cask --zap --force xamarin-ios &
brew uninstall --cask --zap --force xamarin-mac &
wait
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" -- --force
fi
# # Uninstall Xcode and Command Line Tools
# mkdir -p /tmp/trash
# for trash in /Applications/Xcode*.app /Library/Developer/CommandLineTools; do
# sudo mv "$trash" /tmp/trash/
# done
# sudo pkgutil --forget com.apple.pkg.CLTools_Executables
# sudo xcode-select --reset
# Clean environment.
for trash in ~/.DS_Store \
~/.Trash/* \
~/.aliyun \
~/.android \
~/.azcopy \
~/.azure \
~/.bash_history \
~/.bash_profile \
~/.bash_sessions \
~/.bashrc \
~/.cabal \
~/.cache \
~/.cargo \
~/.cocoapods \
~/.composer \
~/.conda \
~/.config \
~/.dotnet \
~/.fastlane \
~/.gem \
~/.ghcup \
~/.gitconfig \
~/.gradle \
~/.local \
~/.m2 \
~/.mono \
~/.npm \
~/.npmrc \
~/.nvm \
~/.oracle_jre_usage \
~/.packer.d \
~/.rustup \
~/.sh_history \
~/.ssh \
~/.subversion \
~/.sqlite_history \
~/.vcpkg \
~/.viminfo \
~/.wget-hsts \
~/.yarn \
~/Library/Caches/Homebrew \
~/Microsoft \
~/hostedtoolcache \
~/*.txt; do
if [[ -e "$trash" ]]; then
mv "$trash" /tmp/trash/
fi
done
# Delete broken symlinks.
for exe in /usr/local/bin/*; do
if [[ -L "$exe" ]] && ! [[ -e "$exe" ]]; then
rm "$exe"
fi
done
mkdir -p /tmp/trash
for pkg in /var/db/receipts/*.plist; do
pkg_id="$(basename "${pkg}" .plist)"
volume="$(pkgutil --pkg-info "${pkg_id}" | sed -n -e 's/^volume: //p')"
location="$(pkgutil --pkg-info "${pkg_id}" | sed -n -e 's/^location: //p')"
pkgutil --only-files --files "${pkg_id}" | xargs -I% sudo mv -f "${volume}${location}/%" /tmp/trash/ || true
pkgutil --only-dirs --files "${pkg_id}" | xargs -I% sudo rmdir -p "${volume}${location}/%" || true
pkgutil --forget "${pkg_id}"
done
59 changes: 59 additions & 0 deletions .github/workflows/release-happ.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "release-happ"
on:
push:
tags:
- 'happ-v[0-9]+.[0-9]+.[0-9]+'
branches:
- develop-0.3

jobs:
publish-happ:
permissions:
contents: write
runs-on: ubuntu-22.04
outputs:
releaseId: ${{ steps.create-release.outputs.id }}
appVersion: ${{ steps.version.outputs.APP_VERSION }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# Checks out a copy of your repository on the ubuntu-latest machine
- uses: actions/checkout@v3

- name: Install nix
uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
nix_path: nixpkgs=channel:nixos-24.05

- uses: cachix/cachix-action@v15
with:
name: holochain-ci

- uses: cachix/cachix-action@v15
with:
name: holochain-open-dev

- uses: cachix/cachix-action@v15
with:
name: darksoil-studio

- name: Install and test
run: |
nix-store --gc
nix develop --no-update-lock-file --accept-flake-config --command bash -c "npm install && npm run build:happ"
- name: Retrieve version
run: |
echo "APP_VERSION=$(cat src-tauri/tauri.conf.json | grep -oP '(?<="version": ")[^"]*')" >> $GITHUB_OUTPUT
id: version

- id: create-release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "workdir/relay.happ"
body: "See assets below to download and install this version."
name: Relay hApp v${{ steps.version.outputs.APP_VERSION }}
tag: happ-v${{ steps.version.outputs.APP_VERSION }}
prerelease: true
draft: false
Loading

0 comments on commit 5da74db

Please sign in to comment.