Skip to content

Commit

Permalink
Release versoview to github releases (#203)
Browse files Browse the repository at this point in the history
* Release versoview to github releases

* Add linux nix

* Fix target and path

* Remove arm64 and windows and x64 mac for now

* Enable sccache

* Fix zip path

* Don't use sccache for nix

* Use artifacts path

* Wrong path

* Use tar.gz and split windows and mac

* use cd instead

* Fix missing .tar.gz

* Missing slash

* missing .tar.gz

* Wrong directory

* Sawp verso and versoview
  • Loading branch information
Legend-Master authored Oct 22, 2024
1 parent 86baa1a commit 8c8a794
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
- name: Fetch Verso version
if: ${{ github.event_name == 'schedule' }}
run: |
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "verso") | .version')" >> $GITHUB_ENV
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "versoview") | .version')" >> $GITHUB_ENV
- name: Generate flatpak cargo sources
if: ${{ github.event_name == 'schedule' }}
Expand Down Expand Up @@ -190,7 +190,7 @@ jobs:
- name: Fetch Verso version
if: ${{ github.event_name == 'schedule' }}
run: |
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "verso") | .version')" >> $Env:GITHUB_ENV
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "versoview") | .version')" >> $Env:GITHUB_ENV
- name: Upload artifact
if: ${{ github.event_name == 'schedule' }}
Expand Down Expand Up @@ -261,7 +261,7 @@ jobs:
- name: Fetch Verso version
if: ${{ github.event_name == 'schedule' }}
run: |
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "verso") | .version')" >> $GITHUB_ENV
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "versoview") | .version')" >> $GITHUB_ENV
- name: Upload artifact
if: ${{ github.event_name == 'schedule' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
nix-channel --update nixpkgs
- name: "Build Verso docs"
run: nix-shell shell.nix --run 'cargo doc -p verso --no-deps'
run: nix-shell shell.nix --run 'cargo doc -p versoview --no-deps'

- name: "Remove doc lock file"
run: rm target/doc/.lock
Expand Down
137 changes: 137 additions & 0 deletions .github/workflows/release-versoview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Release VersoView

on:
workflow_dispatch:

env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v28

- name: Restore and cache Nix store
uses: nix-community/cache-nix-action@v5
with:
paths: |
~/.cargo
target/release/
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', 'Cargo.lock', 'Cargo.toml') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
gc-max-store-size-linux: 1073741824

- name: Add Nix channel
run: |
nix-channel --add https://nixos.org/channels/nixos-24.05 nixpkgs
nix-channel --update nixpkgs
- name: Build
run: nix-shell shell.nix --run 'cargo build --release'

- name: Make archive
run: nix-shell shell.nix --run 'cd ./target/release && tar -czvf verso-x86_64-unknown-linux-gnu.tar.gz versoview'

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: verso-x86_64-unknown-linux-gnu
path: ./target/release/verso-x86_64-unknown-linux-gnu.tar.gz

build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install mako
run: python -m pip install mako

- name: Install scroop
uses: MinoruSekine/setup-scoop@v3
- name: Install dependencies
run: |
scoop install llvm cmake
- name: Build
env:
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: "sccache"
run: cargo build --release

- name: Make archive
working-directory: ./target/release
run: tar -czvf verso-x86_64-pc-windows-msvc.tar.gz versoview.exe

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: verso-x86_64-pc-windows-msvc
path: ./target/release/verso-x86_64-pc-windows-msvc.tar.gz

build-mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install mako
run: python -m pip install mako

- name: Install dependencies
run: |
brew install cmake
curl https://gstreamer.freedesktop.org/data/pkg/osx/1.24.6/gstreamer-1.0-1.24.6-universal.pkg -o runtime.pkg
sudo installer -pkg runtime.pkg -target /
curl https://gstreamer.freedesktop.org/data/pkg/osx/1.24.6/gstreamer-1.0-devel-1.24.6-universal.pkg -o develop.pkg
sudo installer -pkg develop.pkg -target /
- name: Build
env:
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: "sccache"
run: cargo build --release

- name: Make archive
working-directory: ./target/release
run: tar -czvf verso-aarch64-apple-darwin.tar.gz versoview

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: verso-aarch64-apple-darwin
path: ./target/release/verso-aarch64-apple-darwin.tar.gz

publish-release:
runs-on: ubuntu-latest
needs: [build-linux, build-windows, build-mac]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts

- name: Publish release
run: |
RELEASE_TAG=versoview-v$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "versoview") | .version')
git fetch --tags --quiet
if ! git show-ref --tags --verify --quiet "refs/tags/${RELEASE_TAG}" ; then
gh release create ${RELEASE_TAG} ./artifacts/*.tar.gz
fi
18 changes: 9 additions & 9 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[workspace]
members = ["versoview", "versoview_messages"]
members = ["verso", "versoview_messages"]

[workspace.dependencies]
ipc-channel = "0.19"
serde = { version = "1.0", features = ["derive"] }

[package]
name = "verso"
name = "versoview"
version = "0.0.1"
authors = ["Wu Yu Wei"]
edition = "2021"
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Prevent console window from appearing on Windows
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use verso::config::Config;
use verso::{Result, Verso};
use versoview::config::Config;
use versoview::{Result, Verso};
use winit::application::ApplicationHandler;
use winit::event_loop::{self, DeviceEvents};
use winit::event_loop::{EventLoop, EventLoopProxy};
Expand Down
2 changes: 1 addition & 1 deletion versoview/Cargo.toml → verso/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "versoview"
name = "verso"
version = "0.0.1"
edition = "2021"

Expand Down
File renamed without changes.

0 comments on commit 8c8a794

Please sign in to comment.