Skip to content

Commit

Permalink
chore(build): Automated build process in github actions. Switched git…
Browse files Browse the repository at this point in the history
…module paths to use https instead of ssh to fix problems with build on github machines (#180)
  • Loading branch information
WanderingHogan authored Oct 14, 2021
1 parent e3a9ff8 commit da8d069
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 3 deletions.
47 changes: 47 additions & 0 deletions .github/config/changelog_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"categories": [
{
"title": "## 🚀 Features",
"labels": [
"feat",
"feature"
]
},
{
"title": "## 🐛 Fixes",
"labels": [
"fix",
"fixes"
]
},
{
"title": "## 💬 Other",
"labels": [
"chore",
"update",
"doc"
]
},
{
"title": "## 📦 Dependencies",
"labels": [
"dep",
"dependencies"
]
}
],
"sort": "ASC",
"label_extractor": [
{
"pattern": "^.+?(?=\\()",
"method": "match",
"on_property": "title",
"flags": "gu"
}
],
"template": "${{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n${{UNCATEGORIZED}}\n</details>",
"pr_template": "- ${{TITLE}}",
"empty_template": "- No Changes",
"max_pull_requests": 1000,
"max_back_track_time_days": 1000
}
120 changes: 120 additions & 0 deletions .github/workflows/BuildAndroid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: AndroidBuild
on:
push:
tags:
- '*' ## We are watching for all tags. Create a release, generate a new tag, and the rest of this script will run
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
with:
submodules: true ## Installs the android, electron, and locales directory
fetch-depth: 400 ## This fetches entire history, we need this so we can get all the tags
- name: Get Tags/Checkout bug override
run: git fetch --tags --force ## take this out later if https://github.com/actions/checkout/issues/290 is fixed
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV ## Later this is used to update the output files so they have the tag number in the name

- name: Get Current Release Version
run: |
echo $RELEASE_VERSION
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: '16'

- name: Install dependencies
run: yarn

- name: Building Android Version
run: |
yarn android-generate
cp "android/app/build/outputs/apk/debug/app-debug.apk" "android/app/build/outputs/apk/debug/Satellite-${{ env.RELEASE_VERSION }}.apk"
- name: Building Windows Version
run: |
yarn electron-windows
cp "electron/dist/Satellite Setup 0.0.1.exe" "electron/dist/Satellite-Setup-${{ env.RELEASE_VERSION }}.exe"
# cp "electron/dist/Satellite Setup 0.0.1.exe.blockmap" "electron/dist/Satellite-Setup-${{ env.RELEASE_VERSION }}.exe.blockmap"
- name: Building Mac Version
run: |
yarn electron-mac
cp "electron/dist/Satellite-0.0.1-mac.zip" "electron/dist/Satellite-${{ env.RELEASE_VERSION }}-mac.zip"
cp "electron/dist/Satellite-0.0.1-arm64-mac.zip" "electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64-mac.zip"
# cp "electron/dist/Satellite-0.0.1-mac.dmg.blockmap" "electron/dist/Satellite-${{ env.RELEASE_VERSION }}-mac.dmg.blockmap"
# cp "electron/dist/Satellite-0.0.1-arm64-mac.dmg.blockmap" "electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64-mac.dmg.blockmap"
- name: Building Linux Version
run: |
yarn electron-linux
cp "electron/dist/Satellite-0.0.1.AppImage" "electron/dist/Satellite-${{ env.RELEASE_VERSION }}.AppImage"
cp "electron/dist/Satellite-0.0.1-arm64.AppImage" "electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64.AppImage"
- name: Writing checksums to Release
run: |
touch checksums.txt
echo '### sha 256 checksums ###' >> checksums.txt
echo '| platform | checksum | file |' >> checksums.txt
echo '| ----------- | ----------- | ----------- |' >> checksums.txt
(echo '| Android | ') | tr -d '\n' >> checksums.txt
(head -c 64 <<< $(shasum -a 256 android/app/build/outputs/apk/debug/Satellite-${{ env.RELEASE_VERSION }}.apk)) >> checksums.txt
echo ' | Satellite-${{ env.RELEASE_VERSION }}.apk |' >> checksums.txt
(echo '| Windows (x86) | ') | tr -d '\n' >> checksums.txt
(head -c 64 <<< $(shasum -a 256 electron/dist/Satellite-Setup-${{ env.RELEASE_VERSION }}.exe)) >> checksums.txt
echo ' | Satellite-Setup-${{ env.RELEASE_VERSION }}.exe |' >> checksums.txt
(echo '| Linux (arm) | ') | tr -d '\n' >> checksums.txt
(head -c 64 <<< $(shasum -a 256 electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64.AppImage)) >> checksums.txt
echo ' | Satellite-${{ env.RELEASE_VERSION }}-arm64.AppImage |' >> checksums.txt
(echo '| Linux (x86) | ') | tr -d '\n' >> checksums.txt
(head -c 64 <<< $(shasum -a 256 electron/dist/Satellite-${{ env.RELEASE_VERSION }}.AppImage)) >> checksums.txt
echo ' | Satellite-${{ env.RELEASE_VERSION }}.AppImage |' >> checksums.txt
(echo '| Mac (x86) | ') | tr -d '\n' >> checksums.txt
(head -c 64 <<< $(shasum -a 256 electron/dist/Satellite-${{ env.RELEASE_VERSION }}-mac.zip)) >> checksums.txt
echo ' | Satellite-${{ env.RELEASE_VERSION }}-mac.zip |' >> checksums.txt
(echo '| Mac (arm) | ') | tr -d '\n' >> checksums.txt
(head -c 64 <<< $(shasum -a 256 electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64-mac.zip)) >> checksums.txt
echo ' | Satellite-${{ env.RELEASE_VERSION }}-arm64-mac.zip |' >> checksums.txt
- name: Getting Tag Names
run: |
echo $'\n### Changelog ###' >> checksums.txt
echo "ELDERLY=$(git tag --sort version:refname | tail -n 3 | head -n 1)" >> $GITHUB_ENV
echo "START=$(git tag --sort version:refname | tail -n 2 | head -n 1)" >> $GITHUB_ENV
echo "END=$(git tag --sort version:refname | tail -n 1 | head -n 1)" >> $GITHUB_ENV
echo $(git tag)
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitMode: true
configuration: ".github/config/changelog_config.json"
fromTag: "${{ env.ELDERLY }}"
toTag: "${{ env.END }}"
outputFile: ./changelog.txt

- name: Combine Changelog and Checksums
run: |
cat ./changelog.txt >> checksums.txt
sed -i '' '/Merge pull request/d' checksums.txt
sed -i '' '/Merge branch/d' checksums.txt
awk '!visited[$0]++' checksums.txt > deduplicated_checksums.txt
- name: Copy file to release
uses: softprops/action-gh-release@v1
with:
files: |
android/app/build/outputs/apk/debug/Satellite-${{ env.RELEASE_VERSION }}.apk
electron/dist/Satellite-${{ env.RELEASE_VERSION }}.AppImage
electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64.AppImage
electron/dist/Satellite-${{ env.RELEASE_VERSION }}-mac.zip
electron/dist/Satellite-${{ env.RELEASE_VERSION }}-arm64-mac.zip
electron/dist/Satellite-Setup-${{ env.RELEASE_VERSION }}.exe
./deduplicated_checksums.txt
body_path: ./deduplicated_checksums.txt
7 changes: 5 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[submodule "android"]
path = android
url = git@github.com:Satellite-im/Satellite-Build-Android.git
url = https://github.com/Satellite-im/Satellite-Build-Android.git
[submodule "electron"]
path = electron
url = [email protected]:Satellite-im/Satellite-Build-Desktop.git
url = https://github.com/Satellite-im/Satellite-Build-Desktop.git
[submodule "locales"]
path = locales
url = https://github.com/Satellite-im/Satellite-Translations.git
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"android-generate": "yarn generate; npx cap copy; npx cap sync;",
"android-generate": "yarn generate; npx cap copy; npx cap sync; cd android; ./gradlew assembleDebug; cd ..",
"electron-mac": "yarn generate && npx cap update @capacitor-community/electron && npx cap copy @capacitor-community/electron && npx cap sync @capacitor-community/electron && cd electron && yarn && yarn electron:build-mac",
"electron-windows": "yarn generate && npx cap update @capacitor-community/electron && npx cap copy @capacitor-community/electron && npx cap sync @capacitor-community/electron && cd electron && yarn && yarn electron:build-windows",
"electron-linux": "yarn generate && npx cap update @capacitor-community/electron && npx cap copy @capacitor-community/electron && npx cap sync @capacitor-community/electron && cd electron && yarn && yarn electron:build-linux",
Expand Down

0 comments on commit da8d069

Please sign in to comment.