Skip to content

Commit

Permalink
feat: add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
yangtao committed Apr 25, 2024
1 parent f957474 commit 0038708
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/backend-image-bytag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2022 bytetrade
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Publish backend to Dockerhub by tag

on:
push:
branches:
- "main"
tags:
- 'v*'

jobs:
update_dockerhub:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: get latest tag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
id: get-latest-tag
with:
fallback: latest

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
push: true
tags: beclab/market-backend:${{ steps.get-latest-tag.outputs.tag }}
file: Dockerfile

42 changes: 42 additions & 0 deletions .github/workflows/backend-publish_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2022 bytetrade
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Publish backend to Dockerhub manually

on:
workflow_dispatch:
inputs:
tags:
description: 'Release Tags'

jobs:
update_dockerhub:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
push: true
tags: beclab/market-backend:${{ github.event.inputs.tags }}
file: Dockerfile

54 changes: 54 additions & 0 deletions .github/workflows/official-frontend-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Push Official Frontend to Dockerhub

on:
workflow_dispatch:

push:
branches:
- "main"
tags:
- "v*"

jobs:
update_dockerhub:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Print the actor's username
run: echo "The actor is ${{ github.actor }}"
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: get latest tag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
id: get-latest-tag
with:
fallback: latest
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '16.18'
- name: Cache
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/packagge-lock.json')}}
restore-keys: |
${{ runner.os }}-node-
- name: Install
run: |
npm i -g @quasar/cli
- name: Build official
run: npm install -d;npm run build:public;
- run: ls dist
- run: docker info
- name: Build the official Docker image
run: |
docker build . --tag beclab/market-official-frontend:${{ steps.get-latest-tag.outputs.tag }}
docker push beclab/market-official-frontend:${{ steps.get-latest-tag.outputs.tag }}

0 comments on commit 0038708

Please sign in to comment.