feat: 测试从系统环境变量中获取版本信息. #156
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: Build & Test | |
on: | |
#push: | |
# branches: | |
# - main | |
pull_request: | |
branches: | |
- main | |
env: | |
DOTNET_VERSION: "9.0.x" | |
TZ: Asia/Shanghai | |
SOLUTION: EasilyNET.slnx | |
ARTIFACTS: ./artifacts | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get the latest tag for push events | |
if: github.event_name == 'push' | |
id: get_tag_push | |
run: echo "EASILYNET_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Get the latest tag for pull request events | |
if: github.event_name == 'pull_request' | |
id: get_tag_pr | |
run: | | |
TAG=$(git describe --tags --abbrev=0) | |
echo "EASILYNET_VERSION=$TAG" >> $GITHUB_ENV | |
- name: Display the latest tag | |
run: echo $EASILYNET_VERSION | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Build and Test | |
run: ./Test.ps1 | |
shell: pwsh |