Skip to content

chore(types): add more api types to the api client #4

chore(types): add more api types to the api client

chore(types): add more api types to the api client #4

on:
pull_request:
push:
branches:
- master
name: Verify & Publish
jobs:
verify:
runs-on: ubuntu-20.04
steps:
- name: Check out
uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Setup Cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: install cargo-fmt
run: rustup component add rustfmt
- name: install cargo-clippy
run: rustup component add clippy
- name: run cargo:fmt
run: cd src-tauri && cargo fmt --all -- --check
- name: generate ts bindings
run: cd src-tauri && cargo run -q -- generate-bindings --only
- name: install frontend dependencies
run: yarn install
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: run cargo:clippy
run: cd src-tauri && cargo clippy --all-features -- -D warnings
- name: setup Tarpaulin
run: cd src-tauri && cargo install cargo-tarpaulin
continue-on-error: true
- name: run cargo:tarpaulin (runs cargo test)
run: cd src-tauri && cargo tarpaulin --verbose --all-features --out Xml --output-dir ./coverage
- name: Codecov
uses: codecov/codecov-action@v3
with:
files: ./src-tauri/coverage/cobertura.xml
versioning:
permissions:
contents: write
needs: [ verify ]
if: github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'chore(release):')
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn install
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
- uses: actions-rs/cargo@v1
with:
command: install
args: cargo-edit
- name: push & merge back to develop
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "actions@github.com"
git fetch --unshallow
yarn run release
VERSION=$(cat package.json | jq -r '.version')
git tag -d v$VERSION
(cd src-tauri && cargo set-version $VERSION)
(cd src-tauri && jq ".package.version = \"$VERSION\"" tauri.conf.json > tauri.conf.json.tmp && mv tauri.conf.json.tmp tauri.conf.json)
git commit --amend -am "chore(release): $VERSION"
git tag -a v$VERSION -m "chore(release): $VERSION"
git push --follow-tags origin master
git checkout develop
git pull
git merge master
git push
git checkout master
create-release:
needs: [ verify, versioning ]
if: github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'chore(release):')
permissions:
contents: write
runs-on: ubuntu-20.04
outputs:
release_id: ${{ steps.create-release.outputs.result }}
steps:
- uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
- name: pull latest commit
run: git pull
- name: get version & changelog
run: |
VERSION=$(node -p "require('./package.json').version")
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV
echo 'CHANGELOG<<EOF' >> $GITHUB_ENV
echo "$(awk -v ver=$VERSION '
/^(##|###) \[?[0-9]+.[0-9]+.[0-9]+/ {
if (p) { exit };
if (index($2, "[")) {
split($2, a, "[");
split(a[2], a, "]");
if (a[1] == ver) {
p = 1
}
} else {
if ($2 == ver) {
p = 1
}
}
} p
' CHANGELOG.md)" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: create release
id: create-release
uses: actions/github-script@v6
with:
script: |
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `v${process.env.PACKAGE_VERSION}`,
name: `huehuehue v${process.env.PACKAGE_VERSION}`,
body: `${process.env.CHANGELOG}`,
draft: true,
prerelease: false
})
return data.id
build-tauri:
needs: create-release
if: github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'chore(release):')
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [ macos-latest, ubuntu-20.04, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
- name: install Rust nightly
uses: dtolnay/rust-toolchain@nightly
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: pull latest commit
run: git pull
- name: generate ts bindings
run: cd src-tauri && cargo run -q -- generate-bindings --only
- name: install frontend dependencies
run: yarn install
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
publish-release:
permissions:
contents: write
if: github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'chore(release):')
runs-on: ubuntu-20.04
needs: [ create-release, build-tauri ]
steps:
- name: publish release
id: publish-release
uses: actions/github-script@v6
env:
release_id: ${{ needs.create-release.outputs.release_id }}
with:
script: |
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: process.env.release_id,
draft: false,
prerelease: false
})