|
1 | 1 | name: Release BDD nugets |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_dispatch: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'async-abstractions-ui-v*' |
| 7 | + branch: |
| 8 | + - 'BAP-139-automatic-publication-for-playwright-part' |
5 | 9 |
|
6 | 10 | jobs: |
7 | 11 | build_application: |
8 | 12 | runs-on: ubuntu-latest |
9 | | - env: |
10 | | - DOTNET_NOLOGO: true |
11 | 13 | steps: |
12 | 14 | - name: checkout |
13 | 15 | uses: actions/checkout@v2 |
14 | 16 | with: |
15 | 17 | fetch-depth: 0 |
16 | | - - name: setup dotnet |
17 | | - uses: actions/setup-dotnet@v4 |
18 | | - with: |
19 | | - dotnet-version: '8.0.x' |
20 | | - include-prerelease: true |
21 | | - - name: restore packages |
22 | | - run: dotnet restore |
23 | | - - name: build |
24 | | - run: dotnet build -c Release --no-restore |
25 | | - - name: Get version |
26 | | - run: | |
27 | | - export VER=$(grep -oP '\d+\.\d+\.\d+(?=</PackageVersion>)' Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj) |
28 | | - echo "VER=$VER" >> $GITHUB_ENV |
29 | | - echo $VER |
30 | | - - name: Package app |
| 18 | + |
| 19 | + - name: Extract Version and Project Name |
| 20 | + id: version |
31 | 21 | run: | |
32 | | - dotnet pack ./Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj \ |
33 | | - --configuration Release /p:Platform=\"AnyCPU\" \ |
34 | | - /p:PackageVersion=${{ env.VER }} --output ./ |
35 | | - - name: Create Release |
36 | | - uses: ncipollo/release-action@v1 |
37 | | - with: |
38 | | - tag: ${{ env.VER }} |
39 | | - artifacts: "Behavioral.Automation.${{ env.VER }}.nupkg" |
40 | | - bodyFile: "Behavioral.Automation.Selenium/CHANGELOG.md" |
41 | | - token: ${{ secrets.GITHUB_TOKEN }} |
42 | | - - name: Publish app into nuget.org |
43 | | - env: |
44 | | - NUGET_API_KEY: ${{ secrets.QUANTORI_NUGET_API_KEY }} |
45 | | - run: dotnet nuget push ./Behavioral.Automation.${{ env.VER }}.nupkg -s "https://api.nuget.org/v3/index.json" -k "$NUGET_API_KEY" --skip-duplicate |
| 22 | + TAG_NAME=${{ github.ref_name }} |
| 23 | + if [[ "$TAG_NAME" =~ ^async-abstractions-ui-v([0-9]+\.[0-9]+)$ ]]; then |
| 24 | + PROJECT_PATH="Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj" |
| 25 | + PACKAGE_VERSION="${BASH_REMATCH[1]}" |
| 26 | + else |
| 27 | + echo "Unknown tag format: $TAG_NAME" |
| 28 | + exit 1 |
| 29 | + fi |
| 30 | +
|
| 31 | + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV |
| 32 | + echo "PROJECT_PATH=$PROJECT_PATH" >> $GITHUB_ENV |
| 33 | + echo "Detected Version: $PACKAGE_VERSION for project $PROJECT_PATH" |
| 34 | +
|
| 35 | +# - name: setup dotnet |
| 36 | +# uses: actions/setup-dotnet@v4 |
| 37 | +# with: |
| 38 | +# dotnet-version: '8.0.x' |
| 39 | +# include-prerelease: true |
| 40 | +# - name: restore packages |
| 41 | +# run: dotnet restore |
| 42 | +# - name: build |
| 43 | +# run: dotnet build -c Release --no-restore |
| 44 | +# - name: Get version |
| 45 | +# run: | |
| 46 | +# export VER=$(grep -oP '\d+\.\d+\.\d+(?=</PackageVersion>)' Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj) |
| 47 | +# echo "VER=$VER" >> $GITHUB_ENV |
| 48 | +# echo $VER |
| 49 | +# - name: Package app |
| 50 | +# run: | |
| 51 | +# dotnet pack ./Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj \ |
| 52 | +# --configuration Release /p:Platform=\"AnyCPU\" \ |
| 53 | +# /p:PackageVersion=${{ env.VER }} --output ./ |
| 54 | +# - name: Create Release |
| 55 | +# uses: ncipollo/release-action@v1 |
| 56 | +# with: |
| 57 | +# tag: ${{ env.VER }} |
| 58 | +# artifacts: "Behavioral.Automation.${{ env.VER }}.nupkg" |
| 59 | +# bodyFile: "Behavioral.Automation.Selenium/CHANGELOG.md" |
| 60 | +# token: ${{ secrets.GITHUB_TOKEN }} |
| 61 | +# - name: Publish app into nuget.org |
| 62 | +# env: |
| 63 | +# NUGET_API_KEY: ${{ secrets.QUANTORI_NUGET_API_KEY }} |
| 64 | +# run: dotnet nuget push ./Behavioral.Automation.${{ env.VER }}.nupkg -s "https://api.nuget.org/v3/index.json" -k "$NUGET_API_KEY" --skip-duplicate |
0 commit comments