Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
luwol03 authored Jan 22, 2022
2 parents cd5864e + dbf644f commit 1c79e27
Show file tree
Hide file tree
Showing 75 changed files with 8,092 additions and 16,458 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
blank_issues_enabled: false
contact_links:
- name: GitHub Discussions
url: https://github.com/vocascan/vocascan-desktop/discussions
url: https://github.com/vocascan/vocascan-frontend/discussions
about: Please ask and answer questions here.
- name: Discord community server
url: https://discord.gg/Q3Qp72sKaQ
Expand Down
185 changes: 185 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
name: CI

on:
- push
- pull_request
- workflow_dispatch

env:
DOCKER_PLATFORMS: linux/amd64,linux/arm/v7,linux/arm64/v8 #,linux/s390x,linux/ppc64le

jobs:
test:
name: 🧪 test
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 14
cache: "npm"

- name: Install dependencies
run: npm i

- name: Lint JS
run: npm run lint:js -- --max-warnings=0

- name: Lint style
if: always()
run: npm run lint:style

build:
name: ⚙️ build
needs: test
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/experimental' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 14
cache: "npm"

- name: Install dependencies
run: npm i

- name: Add custom metadata
uses: actions/github-script@v5
with:
script: |
const fs = require("fs");
const packageJSON = require("./package.json");
packageJSON.metadata = {
commit: context.sha,
date: new Date().toISOString(),
runId: context.runId,
runNumber: context.runNumber,
}
fs.writeFileSync("./package.json", JSON.stringify(packageJSON, null, 2), { encoding: "utf-8" })
- name: Build frontend
run: npm run build

- name: Upload build
uses: actions/upload-artifact@v2
with:
name: build
path: ./build/*
if-no-files-found: error

docker:
name: 🐋 docker
needs: build
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/experimental' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Download build
uses: actions/download-artifact@v2
with:
name: build
path: ./build

- name: Extract version
uses: actions/github-script@v5
id: version
with:
script: |
const { version } = require('./package.json')
const isMain = context.ref === 'refs/heads/main' && !version.includes('rc')
const isExperimental = context.ref === 'refs/heads/experimental' && version.includes('rc')
const tags = [
'type=ref,event=branch',
'type=ref,event=pr',
]
if (isMain || isExperimental) {
tags.push(`type=semver,pattern={{version}},value=${version}`)
}
if (isMain) {
tags.push(`type=semver,pattern={{major}}.{{minor}},value=${version}`)
tags.push(`type=semver,pattern={{major}},value=${version}`)
}
core.setOutput('tags', tags.join('\n'));
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
vocascan/frontend
ghcr.io/vocascan/frontend
tags: ${{ steps.version.outputs.tags }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: vocascan
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to ghcr
uses: docker/login-action@v1
with:
registry: ghcr.io
username: vocascan
password: ${{ secrets.VOCASCAN_BOT_TOKEN }}

- name: Build and Push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile.ci
platforms: ${{ env.DOCKER_PLATFORMS }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max

release:
name: 📦 release
needs: build
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Download build
uses: actions/download-artifact@v2
with:
name: build
path: ./build

- name: Prepare attachments
run: |
zip -r build.zip build
sha256sum -t build.zip > build.zip.sha256
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: build.zip*
token: ${{ secrets.VOCASCAN_BOT_TOKEN }}
7 changes: 4 additions & 3 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ on:

jobs:
check:
name: check pull request
name: 🔍 Check pull request
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'reviewed/skip-check') }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -36,8 +37,8 @@ jobs:
with:
msg: |
Thank you for your pull request.
Please remove your translations. Change only the `en.json` if necessary.
If this pull request is merged into the [`experimental`](https://github.com/vocascan/vocascan-desktop/tree/experimental) branch, it can be translated via [localazy](https://localazy.com/p/vocascan).
Please remove your translations. Change only the `en/default.json` if necessary.
If this pull request is merged into the [`experimental`](https://github.com/vocascan/vocascan-frontend/tree/experimental) branch, it can be translated via [localazy](https://localazy.com/p/vocascan).
Please remove following files from pull request changes.
```
Expand Down
49 changes: 0 additions & 49 deletions .github/workflows/release.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/test.yml

This file was deleted.

34 changes: 18 additions & 16 deletions .github/workflows/translations.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,60 @@
name: translations
name: Translations
on:
push:
branches:
- 'experimental'
- "experimental"
schedule:
- cron: '0 12 * * 0'
- cron: "0 12 * * 0"
workflow_dispatch:

jobs:
update-translations:
name: update translations
name: 📥 Update translations
runs-on: ubuntu-latest
steps:
- name: checkout
- name: Checkout
uses: actions/checkout@v2
with:
ref: experimental
token: ${{ secrets.VOCASCAN_BOT_TOKEN }}

- name: download
- name: Download
uses: localazy/download@v1
with:
read_key: ${{ secrets.LOCALAZY_READ_KEY }}
write_key: ${{ secrets.LOCALAZY_WRITE_KEY }}

- name: push
- name: Push
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[skip ci] updated translations via Localazy"
commit_user_name: VocascanBot
commit_user_email: [email protected]
commit_author: VocascanBot <[email protected]>
file_pattern: src/i18n/locales/**/*.json
file_pattern: src/i18n/locales/**/default.json
branch: experimental

- name: get version
id: prepare
- name: Install dependency
run: |
mv package.json package.json.bak
npm i --no-save --no-package-look semver
npm install --no-package-lock --no-save semver
mv package.json.bak package.json
version=$(node -e "
- name: Extract version
uses: actions/github-script@v5
id: prepare
with:
script: |
const Semver = require('semver');
const package = require('./package.json');
const semver = Semver.parse(package.version);
let version = 0;
if (semver) {
version = 100000000 * semver.major + 10000 * semver.minor + semver.patch;
}
console.log(version.toString(10));
")
echo ::set-output name=version::${version}
core.setOutput("version", version.toString(10));
- name: upload
- name: Upload
uses: localazy/upload@v1
with:
read_key: ${{ secrets.LOCALAZY_READ_KEY }}
Expand Down
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"semi": true,
"useTabs": false,
"importOrder": [
"^./config.js$",
"^(react|uniqid|i18next|redux|axios|clsx|semver|@testing-library)(.*)$",
"^@material-ui/core(.*)$",
"^@material-ui/icons(.*)$",
Expand Down
Loading

0 comments on commit 1c79e27

Please sign in to comment.