-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (122 loc) · 4.29 KB
/
master-pull-request-merge-reaction.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Master pull-request merge reaction
on:
pull_request:
types: [closed]
branches:
- 'master'
env:
artifacts_path: ${{ github.workspace }}/Artifacts
zips_path: ${{ github.workspace }}/Zips
jobs:
tag_master_and_sync_dev:
name: Tag master merge commit, FF back to dev
if: github.event.pull_request.merged == true
runs-on: windows-latest
outputs:
new_version: ${{ steps.get-proj-ver.outputs.version }}
target_fp_version: ${{ steps.check_target_fp.outputs.fp_version }}
steps:
- name: Get project version
id: get-proj-ver
uses: oblivioncth/actions/cmake/get-project-version@dev
- name: Set Git user to ObyBotCI
uses: oblivioncth/actions/git/set-git-user-to-oby-bot@dev
- name: Checkout Project
id: proj-checkout
uses: oblivioncth/actions/git/smart-checkout@dev
- name: Get target FP version
id: check_target_fp
working-directory: ${{ steps.proj-checkout.outputs.path }}
env:
match_start: set\(TARGET_FP_VERSION_PREFIX
match_end: \)
run: |
$project_lists = Get-Content -Raw CMakeLists.txt
if(!($project_lists -match '(?<=${{ env.match_start
}})(.*)(?=${{
env.match_end
}})')){
throw"Could not get target FP version!"
}
$target_version="v$($Matches[1].Trim())"
echo"fp_version=$target_version">> $Env:GITHUB_OUTPUT
- name: Tag master with new version tag
uses: oblivioncth/actions/git/tag@dev
with:
tag: 'v${{ steps.get-proj-ver.outputs.version }}'
message: 'Release v${{ steps.get-proj-ver.outputs.version }}'
- name: Move 'latest' tag
uses: oblivioncth/actions/git/move-latest-tag@dev
- name: Fast-forward merge master into to dev
if: always()
uses: oblivioncth/actions/git/merge-branches@dev
with:
source_branch: master
target_branch: dev
ff: only
build_clifp_release_windows:
name: Build CLIFp Release (Windows)
needs: tag_master_and_sync_dev
if: github.event.pull_request.merged == true
uses: ./.github/workflows/build-clifp-windows.yml
secrets:
qt_ffynnon_cred: ${{ secrets.OBYBOT_FFYNNON_CREDS }}
build_clifp_release_linux:
name: Build CLIFp Release (Linux)
needs: tag_master_and_sync_dev
if: github.event.pull_request.merged == true
uses: ./.github/workflows/build-clifp-linux.yml
secrets:
qt_ffynnon_cred: ${{ secrets.OBYBOT_FFYNNON_CREDS }}
update-redirect:
name: Update redirect page
if: github.event.pull_request.merged == true
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.page-deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup pages
uses: actions/configure-pages@v3
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v1
with:
path: ${{ github.workspace }}/redirector
- name: Deploy pages artifact
id: page-deployment
uses: actions/deploy-pages@v1
create-release:
name: Create GitHub release
needs: [build_clifp_release_windows, build_clifp_release_linux, tag_master_and_sync_dev]
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Download built CLIFp artifacts
uses: actions/download-artifact@v3
with:
path: ${{ env.artifacts_path }}
- name: Zip up release artifacts
shell: pwsh
run: |
$artifact_folders = Get-ChildItem -Directory -Path "${{ env.artifacts_path }}" -Exclude "github-pages"
foreach($art_dir in $artifact_folders)
{
$name = $art_dir.name
$path = $art_dir.fullname
7z a "${{ env.zips_path }}/${name}.zip" "${path}/*"
}
- name: Generate release
uses: softprops/action-gh-release@v1
with:
name: "CLIFp Release v${{ needs.tag_master_and_sync_dev.outputs.new_version }} (Targets FP ${{ needs.tag_master_and_sync_dev.outputs.target_fp_version }})"
tag_name: "v${{ needs.tag_master_and_sync_dev.outputs.new_version }}"
fail_on_unmatched_files: true
generate_release_notes: true
files: |
${{ env.zips_path }}/*.zip