Skip to content

Commit

Permalink
Merge pull request #152 from opeolluwa/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
opeolluwa committed Jun 23, 2023
2 parents 05d1c0f + a09a3d0 commit 8722961
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 68 deletions.
63 changes: 6 additions & 57 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,11 @@
name: 'publish'

on:
push:
branches:
- release

jobs:
create-release:
permissions:
contents: write
runs-on: ubuntu-20.04
outputs:
release_id: ${{ steps.create-release.outputs.result }}

steps:
- uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
- name: get version
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
- name: create release
id: create-release
uses: actions/github-script@v6
with:
script: |
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `app-v${process.env.PACKAGE_VERSION}`,
name: `Desktop App v${process.env.PACKAGE_VERSION}`,
body: 'Take a look at the assets to download and install this app.',
draft: true,
prerelease: false
})
return data.id
build-tauri:
needs: create-release
publish-tauri:
permissions:
contents: write
strategy:
Expand Down Expand Up @@ -66,26 +33,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}

publish-release:
permissions:
contents: write
runs-on: ubuntu-20.04
needs: [create-release, build-tauri]

steps:
- name: publish release
id: publish-release
uses: actions/github-script@v6
env:
release_id: ${{ needs.create-release.outputs.release_id }}
with:
script: |
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: process.env.release_id,
draft: false,
prerelease: false
})
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: 'App v__VERSION__'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false
22 changes: 11 additions & 11 deletions core/src/utils/ip_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ extern crate pnet_datalink;
extern crate std;

/// Returns IP address of host, excluding localhost, or None if none found.
#[cfg(target_family = "unix")]
pub fn autodetect_ip_address() -> Result<String, ()> {
pnet_datalink::interfaces()
.into_iter()
.filter(|iface| !iface.is_loopback() && iface.is_up())
.flat_map(|iface| iface.ips)
.find(|ip_network| ip_network.is_ipv4())
.map(|ip_network| ip_network.ip().to_string())
.ok_or(())
}
// #[cfg(target_family = "unix")]
// pub fn autodetect_ip_address() -> Result<String, ()> {
// pnet_datalink::interfaces()
// .into_iter()
// .filter(|iface| !iface.is_loopback() && iface.is_up())
// .flat_map(|iface| iface.ips)
// .find(|ip_network| ip_network.is_ipv4())
// .map(|ip_network| ip_network.ip().to_string())
// .ok_or(())
// }

/// Returns IP address of host, excluding localhost, or None if none found.
#[cfg(target_family = "windows")]
// #[cfg(target_family = "windows")]
pub fn autodetect_ip_address() -> Result<String, ()> {
Ok(local_ip().unwrap().to_string())
}
Expand Down

0 comments on commit 8722961

Please sign in to comment.