merge: pr #1 (secure update) #2
Workflow file for this run
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
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 }} |