Skip to content

Commit

Permalink
feat: Rewritten in Rust.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda committed Dec 5, 2022
1 parent 11fa530 commit ffb2d94
Show file tree
Hide file tree
Showing 17 changed files with 756 additions and 303 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Build
on:
push:
branches:
- main
workflow_dispatch:
jobs:
sanity:
name: Sanity Check
runs-on: macos-latest
env:
CARGO_TERM_COLOR: always
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore cached dependencies
uses: actions/cache@v3
with:
path: ~/.cargo
key: cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/Cargo.lock') }}
- name: Setup Rust
run: rustup target add x86_64-apple-darwin aarch64-apple-darwin
- name: Analyze code
run: make check
versionCheck:
name: Check version
runs-on: macos-latest
needs: sanity
outputs:
build: ${{ steps.check.outputs.build }}
steps:
- name: Checkout
uses: actions/checkout@v3
- id: check
name: Check version
run: |
VERSION=$(cargo read-manifest | jq -r .version)
gh release view v$VERSION || echo "build=true" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build
runs-on: macos-latest
needs: versionCheck
if: ${{ needs.versionCheck.outputs.build == 'true' }}
env:
CARGO_TERM_COLOR: always
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore cached dependencies
uses: actions/cache@v3
with:
path: ~/.cargo
key: cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/Cargo.lock') }}
- name: Setup Rust
run: rustup target add x86_64-apple-darwin aarch64-apple-darwin
- name: Build (Intel)
run: make build ARCH=x86_64-apple-darwin
- name: Build (Apple Silicon)
run: make build ARCH=aarch64-apple-darwin
- name: Save artifacts (Intel)
uses: actions/upload-artifact@v2
with:
name: x86_64-apple-darwin
path: ./dist/x86_64-apple-darwin/Alfred Chrome.alfredworkflow
- name: Save artifacts (Apple Silicon)
uses: actions/upload-artifact@v2
with:
name: aarch64-apple-darwin
path: ./dist/aarch64-apple-darwin/Alfred Chrome.alfredworkflow
release:
name: Release
runs-on: macos-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Create release
run: |
VERSION=$(cargo read-manifest | jq -r .version)
mkdir release
mv "artifacts/x86_64-apple-darwin/Alfred Chrome.alfredworkflow" "release/Alfred Chrome (Intel).alfredworkflow"
mv "artifacts/aarch64-apple-darwin/Alfred Chrome.alfredworkflow" "release/Alfred Chrome (Apple Silicon).alfredworkflow"
gh release create -t $VERSION v$VERSION release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/alfred-chrome
vendor/
dist/
target/
Binary file removed Alfred Chrome.alfredworkflow
Binary file not shown.
247 changes: 247 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "alfred-chrome"
version = "5.0.0"
edition = "2021"
description = "Opens a URL in Google Chrome, optionally in incognito and with specific profile."
homepage = "https://sw.cowtech.it/alfred-chrome"
repository = "https://github.com/ShogunPanda/alfred-chrome"
license = "ISC"
keywords = ["terminal"]
categories = ["command-line-utilities", "command-line-interface"]

[dependencies]
glob = "^0.3.0"
md-5 = "^0.10.5"
plist = "^1.3.1"
serde = { version = "^1.0.149", features = ["derive"] }
serde_json = { version = "^1.0.89" }

[profile.release]
opt-level = 3
lto = true
debug = 0
strip = "symbols"
codegen-units = 1
debug-assertions = false
15 changes: 0 additions & 15 deletions Gopkg.lock

This file was deleted.

0 comments on commit ffb2d94

Please sign in to comment.