|
| 1 | +on: |
| 2 | + push: |
| 3 | + branches: |
| 4 | + - develop |
| 5 | + paths-ignore: |
| 6 | + - CHANGELOG.md |
| 7 | + - .vscode/** |
| 8 | + - .github/** |
| 9 | + - images/** |
| 10 | + - tests/** |
| 11 | + - *.md |
| 12 | + - *.ps1 |
| 13 | + - *.yml |
| 14 | + tags: |
| 15 | + - '**' |
| 16 | + - '!*preview*' |
| 17 | +env: |
| 18 | + buildFolderName: output |
| 19 | + buildArtifactName: output |
| 20 | + testResultFolderName: testResults |
| 21 | +jobs: |
| 22 | + Build_Stage_Package_Module: |
| 23 | + name: Package Module |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - name: Checkout Code |
| 27 | + uses: actions/checkout@v3 |
| 28 | + with: |
| 29 | + ref: ${{ github.head_ref }} # checkout the correct branch name |
| 30 | + fetch-depth: 0 |
| 31 | + - name: Install GitVersion |
| 32 | + uses: gittools/actions/gitversion/setup@v0.9.15 |
| 33 | + with: |
| 34 | + versionSpec: 5.x |
| 35 | + - name: Evaluate Next Version |
| 36 | + uses: gittools/actions/gitversion/execute@v0.9.15 |
| 37 | + with: |
| 38 | + configFilePath: GitVersion.yml |
| 39 | + - name: Build & Package Module |
| 40 | + shell: pwsh |
| 41 | + run: ./build.ps1 -ResolveDependency -tasks pack -Verbose |
| 42 | + env: |
| 43 | + ModuleVersion: ${{ env.gitVersion.NuGetVersionV2 }} |
| 44 | + - name: Publish Build Artifact |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: ${{ env.buildArtifactName }} |
| 48 | + path: ${{ env.buildFolderName }}/ |
| 49 | + |
| 50 | + Deploy_Stage_Deploy_Module: |
| 51 | + name: Deploy Module |
| 52 | + runs-on: ubuntu-latest |
| 53 | + needs: |
| 54 | + - Build_Stage_Package_Module |
| 55 | + if: ${{ success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }} |
| 56 | + steps: |
| 57 | + - name: Checkout Code |
| 58 | + uses: actions/checkout@v3 |
| 59 | + with: |
| 60 | + ref: ${{ github.head_ref }} # checkout the correct branch name |
| 61 | + fetch-depth: 0 |
| 62 | + - name: Download Build Artifact |
| 63 | + uses: actions/download-artifact@v4 |
| 64 | + with: |
| 65 | + name: ${{ env.buildArtifactName }} |
| 66 | + path: ${{ env.buildFolderName }} |
| 67 | + - name: Publish Release |
| 68 | + shell: pwsh |
| 69 | + run: ./build.ps1 -tasks publish |
| 70 | + env: |
| 71 | + GitHubToken: ${{ secrets.GitHubToken }} |
| 72 | + GalleryApiToken: ${{ secrets.GalleryApiToken }} |
0 commit comments