mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-06-20 02:38:15 +08:00
ci: 🎡 版本发布脚本 (#110)
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
# This workflow will build a .NET project
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
|
||||
|
||||
name: CI
|
||||
name: nightly-build
|
||||
|
||||
on:
|
||||
push:
|
58
.github/workflows/release.yml
vendored
Normal file
58
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
# This workflow will build a .NET project
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
|
||||
|
||||
name: nightly-build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [ 20.x ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
filter: tree:0
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
# https://docs.github.com/zh/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('./src/frontend/admin/package.json') }}
|
||||
restore-keys: ${{ runner.os }}-npm
|
||||
- working-directory: ./src/frontend/admin
|
||||
run:
|
||||
npm install && npm run build
|
||||
- uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
|
||||
restore-keys: ${{ runner.os }}-nuget
|
||||
- working-directory: ./src/backend/NetAdmin.AdmServer.Host
|
||||
run: dotnet publish NetAdmin.AdmServer.Host.csproj -c Release
|
||||
- uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
- id: get_version
|
||||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
|
||||
- run: docker build -t nsnail/netadmin:${{steps.get_version.outputs.VERSION}} .
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
username: "nsnail"
|
||||
password: "${{secrets.DOCKER_PASSWORD}}"
|
||||
- run: docker push nsnail/netadmin:${{steps.get_version.outputs.VERSION}}
|
Reference in New Issue
Block a user