-
-
Notifications
You must be signed in to change notification settings - Fork 1
147 lines (127 loc) · 5.17 KB
/
build.yml
File metadata and controls
147 lines (127 loc) · 5.17 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Build SideBackup
on:
push:
branches:
- '**'
tags:
- '*.*.*'
pull_request:
types: [opened, synchronize, reopened]
branches:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.base_ref || github.ref_name }}
cancel-in-progress: true
jobs:
build:
if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) || (github.ref_name == 'main' || github.ref_name == 'develop')
name: Build and Archive
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install Xcode
uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: latest-stable
- name: Set Up Xcode Cache
uses: irgaly/xcode-cache@v1.9.2
with:
key: xcode-cache-deriveddata-${{ github.base_ref || github.ref_name }}
restore-keys: xcode-cache-dereviddata-${{ github.base_ref || github.ref_name }}
- name: Build
id: build
run: ./.github/makeipa
- name: Upload Release
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v2.5.0
with:
files: |
build/${{ steps.build.outputs.log }}
build/${{ steps.build.outputs.sym }}
build/${{ steps.build.outputs.ipa }}
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload nightly
if: github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'develop')
uses: altemiq/update-existing-release@v1.3.5
with:
token: ${{ secrets.GITHUB_TOKEN }}
release: nightly
tag: nightly
replace: true
prerelease: true
files: >
build/${{ steps.build.outputs.log }}
build/${{ steps.build.outputs.sym }}
build/${{ steps.build.outputs.ipa }}
body: |
Automated nightly build from commit ${{ github.sha }}
**Branch:** ${{ github.ref_name }}
**Commit:** ${{ github.event.head_commit.message }}
**Built:** ${{ github.event.head_commit.timestamp }}
- name: Upload IPA
if: github.event_name == 'pull_request' && github.event.pull_request.draft == false
uses: actions/upload-artifact@v6
with:
name: ${{ steps.build.outputs.ipa }}
path: build/${{ steps.build.outputs.ipa }}
compression-level: 0
- name: Upload Build Log
if: github.event_name == 'pull_request' && github.event.pull_request.draft == false
uses: actions/upload-artifact@v6
with:
name: ${{ steps.build.outputs.log }}
path: build/${{ steps.build.outputs.log }}
compression-level: 0
- name: Upload dSYM
if: github.event_name == 'pull_request' && github.event.pull_request.draft == false
uses: actions/upload-artifact@v6
with:
name: ${{ steps.build.outputs.sym }}
path: build/${{ steps.build.outputs.sym }}
compression-level: 0
- name: Upload PR Comment
uses: actions/github-script@v8
if: github.event_name == 'pull_request' && github.event.pull_request.draft == false
with:
# This snippet is public-domain, taken from
# https://github.com/oprypin/nightly.link/blob/master/.github/workflows/pr-comment.yml
# slightly modified by nythepegasus
script: |
async function upsertComment(owner, repo, issue_number, purpose, body) {
const {data: comments} = await github.rest.issues.listComments(
{owner, repo, issue_number});
const marker = `<!-- bot: ${purpose} -->`;
body = marker + "\n" + body;
const existing = comments.filter((c) => c.body.includes(marker));
if (existing.length > 0) {
const last = existing[existing.length - 1];
core.info(`Updating comment ${last.id}`);
await github.rest.issues.updateComment({
owner, repo,
body,
comment_id: last.id,
});
} else {
core.info(`Creating a comment in issue / PR #${issue_number}`);
await github.rest.issues.createComment({issue_number, body, owner, repo});
}
}
const {owner, repo} = context.repo;
const run_id = ${{ github.run_id }};
const artifacts = await github.paginate(
github.rest.actions.listWorkflowRunArtifacts, {owner, repo, run_id});
if (!artifacts.length) {
return core.error(`No artifacts found`);
}
let body = `Download the artifacts for this pull request:\n`;
for (const art of artifacts) {
body += `\n* [${art.name}.zip](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
}
core.info("Review thread message body:", body);
await upsertComment(owner, repo, ${{ github.event.pull_request.number }}, "nightly-link", body);