-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
75 changed files
with
8,092 additions
and
16,458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.