Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release versoview to github releases #203

Merged
merged 18 commits into from
Oct 22, 2024
Merged
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions .github/workflows/release-versoview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
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: Upload artifact
uses: actions/upload-artifact@v4
with:
name: verso-x86_64-unknown-linux-gnu
path: ./target/release/verso

build-others:
Legend-Master marked this conversation as resolved.
Show resolved Hide resolved
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
exe: .exe
# - os: windows-latest
# target: aarch64-pc-windows-msvc
# exe: .exe
- os: macos-14
target: aarch64-apple-darwin
# - os: macos-13
# target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4

- 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
if: ${{ startsWith(matrix.os, 'windows') }}
uses: MinoruSekine/setup-scoop@v3
- name: Install windows dependencies
if: ${{ startsWith(matrix.os, 'windows') }}
run: |
scoop install llvm cmake

- name: Install mac dependencies
if: ${{ startsWith(matrix.os, 'macos') }}
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: Add rust target
run: rustup target add ${{ matrix.target }}

- name: Build
env:
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: "sccache"
run: cargo build --release --target ${{ matrix.target }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: verso-${{ matrix.target }}
path: ./target/${{ matrix.target }}/release/verso${{ matrix.exe }}

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

- working-directory: ./artifacts/verso-x86_64-pc-windows-msvc
run: zip -r ../verso-x86_64-pc-windows-msvc.zip *
- working-directory: ./artifacts/verso-aarch64-apple-darwin
run: zip -r ../verso-aarch64-apple-darwin.zip *
- working-directory: ./artifacts/verso-x86_64-unknown-linux-gnu
run: zip -r ../verso-x86_64-unknown-linux-gnu.zip *
Legend-Master marked this conversation as resolved.
Show resolved Hide resolved

- name: Publish release
working-directory: ./artifacts
run: |
RELEASE_TAG=versoview-v$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "verso") | .version')
git fetch --tags --quiet
if ! git show-ref --tags --verify --quiet "refs/tags/${RELEASE_TAG}" ; then
gh release create ${RELEASE_TAG} ./*.zip
fi