Skip to content

Commit

Permalink
Add logic to build all apps from dist
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaifroid committed Jul 2, 2023
1 parent 8653ba0 commit 1119183
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
30 changes: 24 additions & 6 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,33 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

# Build the production version of the app
- name: Build app for production
shell: bash
run: |
npm ci
npm run build
# Install packages in dist folder as well
cd ./dist
npm ci
# Set up secret files from encrypted secrets
- name: Set up secret files
- name: Set up secret files and copy needed scripts to dist
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
CHROME_EXTENSION_KEY: ${{ secrets.CHROME_EXTENSION_KEY }}
shell: bash
run: |
echo "$SSH_KEY" > ./scripts/ssh_key
chmod 600 ./scripts/ssh_key
echo "$CHROME_EXTENSION_KEY" > ./scripts/kiwix-html5.pem
chmod 600 ./scripts/kiwix-html5.pem
mkdir -p ./dist/scripts
echo "$SSH_KEY" > ./dist/scripts/ssh_key
chmod 600 ./dist/scripts/ssh_key
echo "$CHROME_EXTENSION_KEY" > ./dist/scripts/kiwix-html5.pem
chmod 600 ./dist/scripts/kiwix-html5.pem
cp ./scripts/create_all_packages.sh ./dist/scripts/create_all_packages.sh
cp ./scripts/package_chrome_extension.sh ./dist/scripts/package_chrome_extension.sh
cp ./scripts/package_firefox_extension.sh ./dist/scripts/package_firefox_extension.sh
cp ./scripts/package_ubuntu_touch_app.sh ./dist/scripts/package_ubuntu_touch_app.sh
cp -f ./ubuntu_touch/* dist/
# Set up the environment
- name: Setup environment
Expand All @@ -54,7 +70,7 @@ jobs:
sudo apt-get --yes install ./scripts/ubuntu_touch_packages/*.deb
# Runs the build scripts
- name: Run the build scripts
- name: Run the build scripts to make extensions and packages
env:
MOZILLA_API_SECRET: ${{ secrets.MOZILLA_API_SECRET }}
MOZILLA_API_KEY: ${{ secrets.MOZILLA_API_KEY }}
Expand All @@ -76,6 +92,8 @@ jobs:
# Run xvfb to make Chrome/Chromium believe it has a display. Else it fails signing the package
Xvfb -ac :99 -screen 0 1280x1024x16 &
export DISPLAY=:99
# Switch to the distribution directory
cd ./dist
if [ -z "$TAG_NAME" ]; then
./scripts/create_all_packages.sh
else
Expand Down
8 changes: 6 additions & 2 deletions scripts/create_all_packages.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash

# DEV: If running this script manually, you probably want to build the app first (npm run build), copy the
# scripts/ into dist/scripts, and cd to the dist directory before running this script from dist/scripts.

BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/..
echo -e "\nBASEDIR is $BASEDIR"
cd "$BASEDIR"
Expand Down Expand Up @@ -26,7 +30,7 @@ echo -e "Version to replace: $VERSION_TO_REPLACE\n"
# Set the secret environment variables if available
# The file set_secret_environment_variables.sh should not be commited for security reasons
# It is only useful to run the scripts locally.
# Travis injects the same environment variables by itself
# Github injects the same environment variables by itself
if [ -r "$BASEDIR/scripts/set_secret_environment_variables.sh" ]; then
. "$BASEDIR/scripts/set_secret_environment_variables.sh"
fi
Expand Down Expand Up @@ -56,7 +60,7 @@ fi
mkdir -p tmp
rm -rf tmp/*
cp -r www manifest.json manifest.v2.json manifest.webapp LICENSE-GPLv3.txt service-worker.js README.md tmp/
# Remove unwanted files
# Remove unwanted files (this line should not be necessary if building from dist/)
rm -f tmp/www/js/lib/libzim-*dev.*

# Replace the version number everywhere
Expand Down

0 comments on commit 1119183

Please sign in to comment.