Skip to content

Instantly share code, notes, and snippets.

@icidasset
Created August 5, 2020 17:03
Show Gist options
  • Save icidasset/52c289a08f4a3cd3262a43ca56ce4ae2 to your computer and use it in GitHub Desktop.
Save icidasset/52c289a08f4a3cd3262a43ca56ce4ae2 to your computer and use it in GitHub Desktop.
name: Build Native Version
on:
workflow_dispatch:
inputs:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v10
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: mstksg/get-package@v1
with:
apt-get: libgmp-dev
- uses: mstksg/setup-stack@v1
# Tasks
- run: nix-shell --run "just install-deps"
- run: nix-shell --run "just build-prod"
# Upload artifacts
- uses: actions/upload-artifact@v2
with:
name: build
path: build/
create-release:
needs: build
runs-on: ubuntu-latest
outputs:
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.upload_id }}
steps:
- uses: actions/checkout@v2
- run: mkdir compressed
# Download artifacts
- uses: actions/download-artifact@v2
with:
name: build
path: build/
# Create zip
- uses: montudor/[email protected]
with:
args: zip -qq -r ./compressed/diffuse-web.zip ./build
# Create tar.gz
- uses: master-atul/[email protected]
with:
command: c
cwd: .
files: ./build
outPath: compressed/diffuse-web.tar.gz
# Get Diffuse's version number
- run: echo ::set-env name=PACKAGE_VERSION::$(node -p "require('./package.json').version")
# Create release
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ env.PACKAGE_VERSION }}"
release_name: "v${{ env.PACKAGE_VERSION }}"
body: "See the assets to download this version and install."
draft: true
prerelease: true
# Upload assets
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./compressed/diffuse-web.zip
asset_name: diffuse-web.zip
asset_content_type: application/zip
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./compressed/diffuse-web.tar.gz
asset_name: diffuse-web.tar.gz
asset_content_type: application/gzip
tauri:
needs: create-release
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/setup-node@v1
with:
node-version: 14
# Download artifacts
- uses: actions/download-artifact@v2
with:
name: build
path: build/
# Dependencies
- run: cargo install tauri-bundler --force
- name: install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
# Tasks
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
distPath: ../build
iconPath: ./src/Static/Images/icon.png
releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment