Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
baobao1270 committed May 23, 2024
0 parents commit 6b4e51e
Show file tree
Hide file tree
Showing 50 changed files with 26,074 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Build
run: dotnet build "AppsApi.csproj" -c Debug
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: AppsApi
path: bin/Debug/net8.0
88 changes: 88 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Release

on:
push:
tags: '*'
workflow_dispatch:

permissions:
contents: write
packages: write

jobs:
tag:
name: Release Tag
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Git Tag
id: tag
run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT

build:
name: Release
needs: [tag]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Build & Publish
run: dotnet publish "AppsApi.csproj" -c Release -o bin/publish -r linux-x64 --nologo --sc true /p:PublishSingleFile=true /p:DebugType=None /p:DebugSymbols=false
- name: Create Release
run: |
tar -cvf bin/apps-api-server-${{ needs.tag.outputs.tag }}.tar -C bin/publish .
zstd -19 bin/apps-api-server-${{ needs.tag.outputs.tag }}.tar
gh release create ${{ needs.tag.outputs.tag }} bin/apps-api-server-${{ needs.tag.outputs.tag }}.tar.zst
env:
GH_TOKEN: ${{ github.token }}

build-docker:
name: Publish (Docker)
needs: [tag]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download & Build Content Safety Library
run: |
rm -vrf ~/.ssh
mkdir -vp ~/.ssh
touch ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
echo "$CONTENT_SAFETY_DEPLOY_KEY" | base64 -d > ~/.ssh/id_ed25519
CS_REPO_NAME=web-apps-content-safety
CS_REPO_DIST=$(mktemp -d)/$CS_REPO_NAME
CS_REPO_URL=git@github.com:luotianyi-dev/$CS_REPO_NAME.git
CS_BLOCKWORD_HOME=$CS_REPO_DIST/blocked-words
CS_BLOCKWORD_DIST=$CS_BLOCKWORD_HOME/dist/blocked-words.lst
CS_BLOCKWORD_MERGER=$CS_BLOCKWORD_HOME/merge.py
CS_BLOCKWORD_TARGET=./Resources/BlockedWord/BlockedWords.txt
git clone $CS_REPO_URL $CS_REPO_DIST
python3 $CS_BLOCKWORD_MERGER
mv -v $CS_BLOCKWORD_DIST $CS_BLOCKWORD_TARGET
cat $CS_BLOCKWORD_TARGET | wc -l
env:
CONTENT_SAFETY_DEPLOY_KEY: ${{ secrets.CONTENT_SAFETY_DEPLOY_KEY }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/luotianyi-dev/apps-api-server:${{ needs.tag.outputs.tag }},ghcr.io/luotianyi-dev/apps-api-server:latest
build-args: |
IMAGE_VERSION=${{ needs.tag.outputs.tag }}
Loading

0 comments on commit 6b4e51e

Please sign in to comment.