2021-04-11 01:09:09 +03:00
|
|
|
# Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
2020-07-19 23:50:56 +03:00
|
|
|
name: version or publish
|
2020-07-19 23:33:12 +03:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- dev
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
version-or-publish:
|
|
|
|
runs-on: ubuntu-latest
|
2020-11-10 17:46:23 +03:00
|
|
|
timeout-minutes: 65
|
2020-07-20 08:19:35 +03:00
|
|
|
outputs:
|
|
|
|
change: ${{ steps.covector.outputs.change }}
|
|
|
|
commandRan: ${{ steps.covector.outputs.commandRan }}
|
|
|
|
successfulPublish: ${{ steps.covector.outputs.successfulPublish }}
|
2020-07-19 23:33:12 +03:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-10-22 17:33:02 +03:00
|
|
|
- uses: actions/setup-node@v2
|
2020-07-19 23:33:12 +03:00
|
|
|
with:
|
2020-11-10 17:46:23 +03:00
|
|
|
node-version: 14
|
2021-04-17 01:55:00 +03:00
|
|
|
registry-url: "https://registry.npmjs.org"
|
2021-10-22 17:33:02 +03:00
|
|
|
cache: yarn
|
|
|
|
cache-dependency-path: tooling/*/yarn.lock
|
2021-11-14 01:49:48 +03:00
|
|
|
|
|
|
|
- name: Cache CLI cargo target
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: tooling/cli.rs/target
|
|
|
|
# Add date to the cache to keep it up to date
|
|
|
|
key: ubuntu-latest-stable-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}-${{ env.CURRENT_DATE }}
|
|
|
|
# Restore from outdated cache for speed
|
|
|
|
restore-keys: |
|
|
|
|
ubuntu-latest-stable-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}
|
|
|
|
ubuntu-latest-stable-cargo-cli-
|
|
|
|
|
|
|
|
- name: build CLI
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --manifest-path ./tooling/cli.rs/Cargo.toml
|
|
|
|
|
2020-07-19 23:33:12 +03:00
|
|
|
- name: cargo login
|
|
|
|
run: cargo login ${{ secrets.crate_token }}
|
|
|
|
- name: git config
|
|
|
|
run: |
|
|
|
|
git config --global user.name "${{ github.event.pusher.name }}"
|
|
|
|
git config --global user.email "${{ github.event.pusher.email }}"
|
2020-07-20 08:35:13 +03:00
|
|
|
- name: covector version or publish (publish when no change files present)
|
2021-04-17 01:55:00 +03:00
|
|
|
uses: jbolda/covector/packages/action@feat/enable-prereleases
|
2020-07-19 23:33:12 +03:00
|
|
|
id: covector
|
2020-07-20 23:21:43 +03:00
|
|
|
env:
|
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
2020-11-10 16:59:04 +03:00
|
|
|
CARGO_AUDIT_OPTIONS: ${{ secrets.CARGO_AUDIT_OPTIONS }}
|
2020-07-19 23:33:12 +03:00
|
|
|
with:
|
2020-07-20 23:21:43 +03:00
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2021-04-17 01:55:00 +03:00
|
|
|
command: "version-or-publish"
|
2020-07-20 07:34:16 +03:00
|
|
|
createRelease: true
|
2020-07-19 23:33:12 +03:00
|
|
|
- name: Create Pull Request With Versions Bumped
|
2020-07-23 05:00:28 +03:00
|
|
|
if: steps.covector.outputs.commandRan == 'version'
|
2020-11-10 09:53:57 +03:00
|
|
|
uses: tauri-apps/create-pull-request@v3.4.1
|
2020-07-19 23:33:12 +03:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
branch: release/version-updates
|
|
|
|
title: Apply Version Updates From Current Changes
|
|
|
|
commit-message: "apply version updates"
|
|
|
|
labels: "version updates"
|
|
|
|
body: ${{ steps.covector.outputs.change }}
|
|
|
|
|
2020-07-21 20:35:43 +03:00
|
|
|
update-docs:
|
|
|
|
needs: version-or-publish
|
|
|
|
if: needs.version-or-publish.outputs.successfulPublish == 'true'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-06-02 14:55:07 +03:00
|
|
|
# Setup
|
2020-07-21 20:35:43 +03:00
|
|
|
- name: checkout tauri
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: tauri
|
|
|
|
- name: checkout tauri-docs
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: tauri-apps/tauri-docs
|
|
|
|
path: tauri-docs
|
2021-06-02 14:55:07 +03:00
|
|
|
- name: checkout tauri-search-bot
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: tauri-apps/tauri-search-bot
|
|
|
|
path: tauri-search-bot
|
2020-07-21 20:35:43 +03:00
|
|
|
- name: install webkit2gtk
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2021-08-15 23:09:55 +03:00
|
|
|
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
|
2021-06-02 14:55:07 +03:00
|
|
|
|
|
|
|
# Rust
|
2020-07-21 20:35:43 +03:00
|
|
|
- name: generate rust docs
|
2021-04-17 01:52:58 +03:00
|
|
|
working-directory: ./tauri/core/tauri
|
2020-07-21 20:35:43 +03:00
|
|
|
run: cargo doc --no-deps
|
|
|
|
- name: run rustdocusaurus
|
2021-06-02 14:55:07 +03:00
|
|
|
uses: tauri-apps/rustdocusaurus/github-action@v1.0.3
|
2020-07-21 20:35:43 +03:00
|
|
|
with:
|
|
|
|
originPath: ./tauri/target/doc/
|
2020-07-30 00:53:30 +03:00
|
|
|
targetPath: ./tauri-docs/docs/en/api/rust/
|
2021-06-02 14:55:07 +03:00
|
|
|
sidebarPath: ./tauri-docs/sidebars/rustdoc.json
|
|
|
|
linksRoot: ""
|
2021-04-21 19:20:12 +03:00
|
|
|
cratesToProcess: "tauri"
|
2021-06-02 14:55:07 +03:00
|
|
|
|
|
|
|
# TypeScript
|
2021-04-17 01:52:58 +03:00
|
|
|
- name: run typedocusaurus
|
2021-04-19 20:53:38 +03:00
|
|
|
uses: tauri-apps/typedocusaurus@v1
|
2021-04-17 01:52:58 +03:00
|
|
|
with:
|
|
|
|
originPath: ./tauri/tooling/api/
|
2021-06-02 14:55:07 +03:00
|
|
|
sidebarFile: ./tauri-docs/sidebars/typedoc.json
|
|
|
|
targetPath: ./tauri-docs/en/api/js/
|
2021-04-17 01:52:58 +03:00
|
|
|
docusaurusPath: ./tauri-docs/
|
2021-06-02 14:55:07 +03:00
|
|
|
|
|
|
|
# Moving docs for Indexation
|
|
|
|
- name: copy docs
|
|
|
|
working-directory: ./tauri
|
2021-11-14 01:49:48 +03:00
|
|
|
run: |
|
|
|
|
mv docs/sidebar.json ${{ github.workspace }}/tauri-docs/sidebars/core.json
|
|
|
|
cp -r docs/!(.templates) ${{ github.workspace }}/tauri-docs/docs/en
|
|
|
|
mv ARCHITECTURE.md ${{ github.workspace }}/tauri-docs/docs/en/about/architecture.md
|
2021-06-02 14:55:07 +03:00
|
|
|
|
|
|
|
# Indexing
|
|
|
|
- name: meilisearch indexation
|
|
|
|
uses: tauri-apps/docusaurus-meilisearch-indexer@v1
|
|
|
|
with:
|
2021-06-23 21:24:23 +03:00
|
|
|
version: ${{ github.event.release.tag_name }}
|
|
|
|
docusaurusPath: ./tauri-docs
|
|
|
|
host: https://search.tauri.studio
|
|
|
|
apiKey: ${{ secrets.MEILISEARCH_APIKEY }}
|
|
|
|
docs: "Getting started,Usage,API"
|
2021-06-02 14:55:07 +03:00
|
|
|
|
|
|
|
# Applying Version
|
|
|
|
- name: set docs' Tauri version
|
|
|
|
working-directory: ./tauri-docs
|
|
|
|
run: echo ${{ github.event.release.tag_name }} > version.txt
|
|
|
|
- name: set bot's Tauri version
|
|
|
|
working-directory: ./tauri-search-bot
|
2021-06-23 21:24:23 +03:00
|
|
|
run: echo ${{ github.event.release.tag_name }} > version.txt
|
|
|
|
|
|
|
|
- uses: iamsauravsharma/create-dotenv@v1.1.0
|
|
|
|
with:
|
2021-10-22 17:33:02 +03:00
|
|
|
directory: "./tauri-search-bot"
|
2021-06-02 14:55:07 +03:00
|
|
|
env:
|
|
|
|
ENV_KEY_DISCORD_BOT_SECRET: ${{ secrets.DISCORD_BOT_SECRET }}
|
2021-06-23 21:24:23 +03:00
|
|
|
ENV_KEY_PREFIX: \!
|
2021-06-02 14:55:07 +03:00
|
|
|
ENV_KEY_SITE: tauri.studio
|
|
|
|
ENV_KEY_ICON: https://i.imgur.com/UzDERvw.png
|
|
|
|
ENV_KEY_LIMIT: 5
|
|
|
|
ENV_KEY_SEARCH_INDEX: ${{ github.event.release.tag_name }}
|
|
|
|
ENV_KEY_MEILISEARCH_PUBLIC_KEY: ea0105f56bb5a2111ed28c7a0c637fc0bed07273f571dc7cb1f73900e44f8e7f
|
|
|
|
|
|
|
|
# Bot Deployment
|
|
|
|
- name: scp bot
|
|
|
|
uses: appleboy/scp-action@master
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.DISCORD_BOT_HOST }}
|
|
|
|
username: ${{ secrets.DISCORD_BOT_SSH_USER }}
|
|
|
|
key: ${{ secrets.DISCORD_BOT_SSH_KEY }}
|
2021-06-23 21:24:23 +03:00
|
|
|
source: "./tauri-search-bot"
|
2021-06-02 14:55:07 +03:00
|
|
|
target: "~/tauri-search-bot"
|
|
|
|
- name: restart the bot
|
|
|
|
uses: appleboy/ssh-action@master
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.DISCORD_BOT_HOST }}
|
|
|
|
username: ${{ secrets.DISCORD_BOT_SSH_USER }}
|
|
|
|
key: ${{ secrets.DISCORD_BOT_SSH_KEY }}
|
|
|
|
script: cd ~/tauri-search-bot && yarn && forever stopall && forever start ./src/index.js
|
|
|
|
|
|
|
|
# tauri-docs PR
|
2020-07-21 20:35:43 +03:00
|
|
|
- name: git config
|
|
|
|
run: |
|
|
|
|
git config --global user.name "${{ github.event.pusher.name }}"
|
|
|
|
git config --global user.email "${{ github.event.pusher.email }}"
|
|
|
|
- name: create pull request for updated docs
|
2020-11-10 09:53:57 +03:00
|
|
|
uses: tauri-apps/create-pull-request@v3.4.1
|
2020-07-21 20:35:43 +03:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.TAURI_BOT_PAT }}
|
2021-04-17 01:52:58 +03:00
|
|
|
commit-message: "chore(docs): Update Rust & TS docs"
|
2020-07-21 20:35:43 +03:00
|
|
|
branch: docs/release
|
|
|
|
path: tauri-docs
|
|
|
|
title: Update Docs
|
|
|
|
labels: "new release"
|
|
|
|
body: |
|
|
|
|
These are the updated docs from the most recent release.
|