Skip to content

Commit

Permalink
Mac bundle (#107)
Browse files Browse the repository at this point in the history
* add code signing

* update workflow to setup cert

* update workflow to setup cert

* update workflow to setup cert

* update workflow to setup cert

* update workflow to setup cert

* update workflow to setup cert

* update workflow to setup cert

* add linux app image

* add linux app image

* add linux app image

* add linux app image

* add linux app image

* update for code signing

* update for code signing

* update workflow to setup cert

* update code signing

* update code signing

* update code signing

* update code signing

* add linux app image

* update codesign
  • Loading branch information
darrell-roberts authored Dec 26, 2024
1 parent 33140be commit 4e9bbd5
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 4 deletions.
68 changes: 66 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
contents: write

jobs:
build-and-release:
build-and-release-macos:
runs-on: macos-latest

steps:
Expand All @@ -22,6 +22,19 @@ jobs:
toolchain: stable
override: true

- name: Setup Certificate
env:
CODE_SIGN_CERTIFICATE: ${{ secrets.CODE_SIGN_CERTIFICATE }}
CERT_PWD: ${{ secrets.CERT_PWD }}
run: |
echo "$CODE_SIGN_CERTIFICATE" | base64 --decode > certificate.p12
stat -f "%N %z" certificate.p12
security create-keychain -p "" build.keychain
security default-keychain -d user -s build.keychain
security unlock-keychain -p "" build.keychain
security import certificate.p12 -k build.keychain -P "$CERT_PWD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "" build.keychain
- name: Build bundle
run: make bundle-mac

Expand All @@ -30,6 +43,57 @@ jobs:
uses: softprops/action-gh-release@v1
with:
files: |
dist/Hacker_News.zip
dist/Hacker_News_aarch64.dmg.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-and-release-linux:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Download linuxdeploy
run: |
wget -nv -c https://github.com/linuxdeploy/linuxdeploy/releases/download/2.0.0-alpha-1-20241106/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
mkdir -p ~/.local/bin
mv linuxdeploy-x86_64.AppImage ~/.local/bin
sudo add-apt-repository universe
sudo apt install libfuse2t64
- name: Build bundle
run: |
export PATH=$HOME/.local/bin:$PATH
make linux-app-image
zip Hacker_News-x86_64.AppImage.zip Hacker_News-x86_64.AppImage
# - name: Build bundle
# uses: AppImageCrafters/build-appimage-action@master
# env:
# UPDATE_INFO: gh-releases-zsync|AppImageCrafters|latest|*x86_64.AppImage.zsync
# with:
# recipe: AppImageBuilder.yml

# - uses: actions/upload-artifact@v2
# with:
# name: AppImage
# path: "./*.AppImage*"

# run: |

- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
Hacker_News-x86_64.AppImage.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ bundle-mac: clean-dist build
cp target/release/hacker-news-iced "dist/Hacker News.app/Contents/MacOS"
chmod +x "dist/Hacker News.app/Contents/MacOS/hacker-news-iced"

codesign --sign "MyApps" "dist/Hacker News.app"

# Copy app to DMG staging area
cp -r "dist/Hacker News.app" "dist/dmg"

Expand All @@ -46,8 +48,21 @@ bundle-mac: clean-dist build

# Clean up
rm "dist/temp.dmg"
cd dist && zip -y "Hacker_News.zip" "Hacker News.dmg"
cd dist && zip -y "Hacker_News_aarch64.dmg.zip" "Hacker News.dmg"

linux-app-image: clean-dist build
echo "Building linux app image"
rm -rf dist/AppDir
# create new AppDir
linuxdeploy-x86_64.AppImage --appdir dist/AppDir

# Copy contents into AppDir
cp target/release/hacker-news-iced dist/AppDir/usr/bin
cp assets/hacker-news.desktop dist/AppDir/usr/share/applications
tar zxvf assets/icons.tar.gz -C dist/AppDir/usr/share

# Create app image
linuxdeploy-x86_64.AppImage --appdir dist/AppDir --output appimage

install-local-linux: build
echo "Installing for linux"
Expand Down
1 change: 0 additions & 1 deletion hacker-news-iced/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ pub enum AppMsg {
ClearVisited,
FullSearch(FullSearchMsg),
SaveConfig,
// Clipboard(String),
SwitchIndex {
category: ArticleType,
count: usize,
Expand Down

0 comments on commit 4e9bbd5

Please sign in to comment.