-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOP-16647] Add Github actions (#15)
* [DOP-16647] Add Github actions
- Loading branch information
1 parent
f0deef1
commit 62a98b6
Showing
19 changed files
with
1,206 additions
and
434 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
tags: | ||
- "[0-9]+.[0-9]+.[0-9]+" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
release: | ||
name: Build & push backend image to Dockerhub | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'MobileTeleSystems/syncmaster-ui' # prevent running on forks | ||
|
||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set tag | ||
id: set_tag | ||
run: | | ||
if [[ "${{ github.ref_type }}" == "branch" && "${{ github.ref_name }}" == "develop" ]]; then | ||
echo "TAG=mtsrus/syncmaster-ui:develop" >> $GITHUB_ENV | ||
elif [[ "${{ github.ref_type }}" == "tag" ]]; then | ||
echo "TAG=mtsrus/syncmaster-ui:latest,mtsrus/syncmaster-ui:${{ github.ref_name }}" >> $GITHUB_ENV | ||
fi | ||
- name: Build UI image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
tags: ${{ env.TAG }} | ||
context: . | ||
target: prod | ||
file: Dockerfile | ||
pull: true | ||
push: true | ||
cache-to: type=inline | ||
cache-from: mtsrus/syncmaster-ui:develop | ||
platforms: | | ||
linux/amd64 | ||
linux/arm64/v8 | ||
provenance: mode=max | ||
|
||
- name: Update DockerHub Description | ||
uses: peter-evans/dockerhub-description@v4 | ||
if: github.ref_type == 'tag' | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
# this requires token with read+write+delete permissions. read+write is not enough! | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
repository: mtsrus/syncmaster-ui | ||
short-description: ${{ github.event.repository.description }} | ||
enable-url-completion: true |
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,37 @@ | ||
name: Code analysis | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches-ignore: | ||
- master | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
linters: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install modules | ||
run: npm ci | ||
|
||
- name: Cache modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./node_modules | ||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | ||
${{ runner.os }}-npm- | ||
- name: Run ESLint | ||
run: npx eslint . | ||
|
||
- name: Run Prettier | ||
run: npx prettier . --check |
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 @@ | ||
npx lint-staged |
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,5 +1,5 @@ | ||
{ | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"printWidth": 80 | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"printWidth": 80 | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
version: "3.8" | ||
services: | ||
syncmaster-ui: | ||
image: syncmaster_ui | ||
image: mtsrus/syncmaster-ui | ||
build: | ||
dockerfile: Dockerfile | ||
context: . | ||
network: host | ||
target: prod | ||
ports: | ||
- 3000:3000 | ||
- 3000:3000 |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import 'proxy-polyfill'; | ||
import "proxy-polyfill"; | ||
|
||
import * as React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import * as React from "react"; | ||
import ReactDOM from "react-dom"; | ||
|
||
import App from './src/App'; | ||
import App from "./src/App"; | ||
|
||
ReactDOM.render(<App />, document.getElementById('root')); | ||
ReactDOM.render(<App />, document.getElementById("root")); |
Oops, something went wrong.