|
1 | 1 | name: Build Management Pack |
2 | 2 |
|
3 | | -# Run when a pull request is closed |
| 3 | +# When a push occurs to the dev or main branches |
4 | 4 | on: |
5 | | - pull_request: |
| 5 | + push: |
6 | 6 | branches: |
7 | | - types: [closed] |
| 7 | + - dev |
| 8 | + - main |
8 | 9 |
|
9 | 10 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel |
10 | 11 | jobs: |
11 | 12 | build: |
12 | | - # Only run when a pull request is merged to dev or main |
13 | | - if: | |
14 | | - ( github.event.pull_request.merged == true ) && |
15 | | - ( |
16 | | - ( github.base_ref == 'main' ) || |
17 | | - ( github.base_ref == 'dev' ) |
18 | | - ) |
| 13 | + # Only run when a push occurs to dev or main |
| 14 | + if: ( github.ref == 'refs/heads/main' ) || ( github.ref == 'refs/heads/dev' ) |
19 | 15 |
|
20 | 16 | # Specify the version of Windows |
21 | 17 | runs-on: windows-latest |
22 | 18 |
|
23 | 19 | steps: |
24 | 20 | # Check out the repository the pull request in merging into (dev/main) |
25 | | - #- name: Checkout Base Repo |
26 | | - # uses: actions/checkout@v2 |
27 | | - # with: |
28 | | - # github-token: ${{ secrets.AM_REPO_BUILD }} |
29 | | - # ref: ${{ github.event.pull_request.base.sha }} |
30 | | - # path: base |
31 | | - |
32 | | - - name: Checkout Head Repo |
| 21 | + - name: Checkout Base Repo |
33 | 22 | uses: actions/checkout@v2 |
34 | 23 | with: |
35 | | - ref: ${{ github.event.pull_request.head.sha }} |
36 | | - repository: ${{ github.event.pull_request.head.repo.full_name }} |
37 | | - path: head |
| 24 | + path: base |
| 25 | + token: ${{ secrets.GITHUB_TOKEN }} |
38 | 26 |
|
39 | 27 | # Execute the build PowerShell script |
40 | 28 | - name: Execute build script |
41 | | - if: | |
42 | | - ( github.base_ref == 'main' ) || |
43 | | - ( ( github.base_ref == 'dev' ) && ( github.head_ref != 'main' ) ) |
| 29 | + if: ( github.ref == 'refs/heads/main' ) || ( github.ref == 'refs/heads/dev' ) |
44 | 30 | shell: powershell |
45 | | - run: .\head\Build\build.ps1 |
| 31 | + run: .\base\Build\build.ps1 |
46 | 32 |
|
47 | 33 | # Upload the management pack files as artifacts |
48 | 34 | - name: Upload Artifacts |
|
53 | 39 |
|
54 | 40 | # Create a release of the management pack |
55 | 41 | - name: Generate Release |
56 | | - if: github.base_ref == 'main' |
| 42 | + if: github.ref == 'refs/heads/main' |
57 | 43 | uses: softprops/action-gh-release@v1 |
58 | 44 | with: |
59 | 45 | name: v${{ env.Version }} |
|
65 | 51 |
|
66 | 52 | # Create a beta release of the management pack |
67 | 53 | - name: Generate Beta Release |
68 | | - if: github.base_ref == 'dev' |
| 54 | + if: github.ref == 'refs/heads/dev' |
69 | 55 | uses: softprops/action-gh-release@v1 |
70 | 56 | with: |
71 | 57 | name: v${{ env.Version }} |
|
74 | 60 | files: ${{ env.ArtifactFileName }} |
75 | 61 | env: |
76 | 62 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
77 | | - |
78 | | - # Open a pull request for dev <- main |
79 | | - - name: Open pull to commit into dev from main |
80 | | - if: ( github.base_ref == 'main' ) && ( github.head_ref == 'dev' ) |
81 | | - uses: peter-evans/create-pull-request@v3 |
82 | | - with: |
83 | | - path: head |
84 | | - commit-message: Update dev version to v${{ env.Version }} |
85 | | - committer: GitHub Actions Bot <[email protected]> |
86 | | - author: GitHub Actions Bot <[email protected]> |
87 | | - branch: main |
88 | | - delete-branch: false |
89 | | - base: dev |
90 | | - title: Rebase dev |
91 | | - body: Update dev to v${{ env.Version }} from main. |
0 commit comments