Skip to content

Commit 6e18f18

Browse files
authored
Merge pull request #449 from KKhanhH/update_pipeline
Update pipeline
2 parents c650d93 + db3141b commit 6e18f18

4 files changed

Lines changed: 141 additions & 118 deletions

File tree

.github/workflows/docker-switch.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
paths:
55
- docker/impacto-switch/*
66
- .github/workflows/docker-switch.yml
7+
workflow_dispatch:
78

89
jobs:
910
build_and_publish:
Lines changed: 14 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- "master"
66
tags:
77
- "*"
8-
pull_request_target:
8+
pull_request:
99
branches:
1010
- "master"
1111
workflow_dispatch:
@@ -25,7 +25,13 @@ jobs:
2525
- uses: actions/checkout@v4
2626
- name: Set version
2727
id: set-version
28-
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
28+
run:
29+
- echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
30+
- name: Upload VERSION Artifact
31+
uses: actions/upload-artifact@v4.1.0
32+
with:
33+
path: VERSION
34+
name: VERSION
2935
lint:
3036
name: Run linters
3137
permissions:
@@ -40,13 +46,9 @@ jobs:
4046
uses: actions/checkout@v4
4147
- name: Update clang-format
4248
run: |
43-
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
44-
sudo apt-add-repository "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-19 main"
4549
sudo apt update
46-
sudo apt install -y clang-format-19
47-
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-19 1000
48-
sudo update-alternatives --set clang-format /usr/bin/clang-format-19
49-
sudo update-alternatives --display clang-format
50+
sudo pipx install clang-format
51+
which clang-format
5052
clang-format --version
5153
5254
- name: Run linters
@@ -84,11 +86,11 @@ jobs:
8486
triplet: x64-linux-ci
8587
host_triplet: x64-linux-ci
8688
- os: macos-15
87-
os_name: macos-arm64
89+
os_name: macos_arm64
8890
triplet: arm64-osx-ci
8991
host_triplet: arm64-osx-ci
9092
- os: macos-15-intel
91-
os_name: macos-x64
93+
os_name: macos_x64
9294
triplet: x64-osx-ci
9395
host_triplet: x64-osx-ci
9496
- os: ubuntu-24.04
@@ -190,7 +192,7 @@ jobs:
190192
cp THIRDPARTY.md README.md LICENSE "${{ github.workspace }}/release/${{ env.PresetName }}"
191193
shell: bash
192194
- name: Decode signing/prod.properties file
193-
if: matrix.os_name == 'android' && (github.event_name != 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.repository)
195+
if: matrix.os_name == 'android' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
194196
env:
195197
PROD_PROPERTIES: ${{ secrets.ANDROID_PROD_PROPERTIES }}
196198
PROD_JKS: ${{ secrets.ANDROID_PROD_JKS }}
@@ -254,110 +256,4 @@ jobs:
254256
uses: actions/upload-artifact@v4.1.0
255257
with:
256258
path: impacto-switch-${{ env.VERSION }}${{ github.run_number }}-${{ github.sha }}.zip
257-
name: release-switch
258-
259-
publish_artifacts:
260-
name: Publish Artifacts
261-
runs-on: ubuntu-22.04
262-
permissions:
263-
contents: write
264-
needs:
265-
- job-matrix
266-
- switch
267-
- get-version
268-
env:
269-
VERSION: ${{ needs.get-version.outputs.VERSION }}
270-
if: needs.job-matrix.result == 'success' && needs.switch.result == 'success' && github.event_name != 'pull_request_target' && ((startsWith(github.ref, 'refs/tags') || github.ref_name == 'master'))
271-
steps:
272-
- uses: actions/download-artifact@v4
273-
with:
274-
pattern: release-*
275-
path: "${{ github.workspace }}/release"
276-
merge-multiple: true
277-
- name: Upload Release
278-
uses: softprops/action-gh-release@v2
279-
if: startsWith(github.ref, 'refs/tags') || (github.ref_name == 'master')
280-
with:
281-
Name: Latest ${{ env.BRANCH_NAME }} build
282-
tag_name: ${{ env.VERSION }}${{ github.run_number }}
283-
files:
284-
${{ github.workspace }}/release/*.zip
285-
prerelease: true
286-
fail_on_unmatched_files: true
287-
target_commitish: ${{ github.sha }}
288-
- name: Get current date
289-
id: date
290-
run: echo "NOW=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
291-
292-
- uses: tsickert/discord-webhook@v5.3.0
293-
with:
294-
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
295-
username: IMPACTO
296-
avatar-url: https://cdn.discordapp.com/emojis/766988033127481344.png
297-
embed-title : "${{ github.event.commits[0].author.name }}"
298-
embed-color: 3659647
299-
embed-timestamp: ${{ env.NOW }}
300-
embed-description: |
301-
Commit
302-
`${{ github.event.head_commit.message }} (${{ github.sha }})`
303-
from branch `${{ env.BRANCH_NAME }}` has been successfully built.
304-
305-
Release URL:
306-
https://github.com/CommitteeOfZero/impacto/releases/tag/${{ env.VERSION }}${{ github.run_number }}
307-
308-
Details:
309-
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
310-
notify_fail:
311-
name: Notify failure
312-
runs-on: ubuntu-22.04
313-
needs:
314-
- job-matrix
315-
- switch
316-
if: always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled'))
317-
steps:
318-
- uses: actions/checkout@v2
319-
- name: 'Get Jobs Status'
320-
id: get_jobs_status
321-
run: |
322-
echo "Fetch workflow run jobs"
323-
json_data=$(curl -s -H "Authorization: Bearer ${{ github.token }}" \
324-
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs")
325-
326-
327-
name_conclusion_array=($(echo "$json_data" | jq -r '
328-
.jobs[] |
329-
select(.name | IN("macos-arm64", "linux", "windows", "switch", "macos-x64", "android")) |
330-
"\(.name).\(.conclusion)"'))
331-
332-
for item in "${name_conclusion_array[@]}"; do
333-
IFS='.' read -r name conclusion <<< "$item"
334-
echo "$name=$conclusion" >> $GITHUB_OUTPUT
335-
done
336-
337-
- name: Get current date
338-
id: date
339-
run: echo "NOW=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
340-
341-
- uses: tsickert/discord-webhook@v5.3.0
342-
with:
343-
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
344-
username: IMPACTO
345-
avatar-url: https://cdn.discordapp.com/emojis/766988033127481344.png
346-
embed-title : "${{ github.event.commits[0].author.name }}"
347-
embed-color: 16711680
348-
embed-timestamp: ${{ steps.date.outputs.NOW }}
349-
embed-description: |
350-
Commit
351-
`${{ github.event.head_commit.message }} (${{ github.sha }})`
352-
from branch `${{ env.BRANCH_NAME }}` has failed build.
353-
354-
Job status:
355-
windows: ${{steps.get_jobs_status.outputs.windows}}
356-
linux: ${{steps.get_jobs_status.outputs.linux}}
357-
macos-arm64: ${{steps.get_jobs_status.outputs.macos-arm64}}
358-
macos-x64: ${{steps.get_jobs_status.outputs.macos-x64}}
359-
switch: ${{steps.get_jobs_status.outputs.switch}}
360-
android: ${{steps.get_jobs_status.outputs.android}}
361-
362-
Details:
363-
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
259+
name: release-switch

.github/workflows/notify.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: notify
2+
on:
3+
workflow_run:
4+
workflows: [impacto]
5+
types:
6+
- completed
7+
tags:
8+
- 'v*'
9+
jobs:
10+
notify_fail:
11+
name: Notify failure
12+
runs-on: ubuntu-22.04
13+
if: always() && (github.event.workflow_run.conclusion.conclusion == "cancelled" || github.event.workflow_run.conclusion.conclusion == "failure")
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: 'Get Jobs Status'
17+
id: get_jobs_status
18+
run: |
19+
echo "Fetch workflow run jobs"
20+
json_data=$(curl -s -H "Authorization: Bearer ${{ github.token }}" \
21+
${{ github.event.workflow_run.jobs_url }}")
22+
23+
24+
name_conclusion_array=($(echo "$json_data" | jq -r '
25+
.jobs[] |
26+
select(.name | IN("macos-arm64", "linux", "windows", "switch", "macos-x64", "android")) |
27+
"\(.name).\(.conclusion)"'))
28+
29+
for item in "${name_conclusion_array[@]}"; do
30+
IFS='.' read -r name conclusion <<< "$item"
31+
echo "$name=$conclusion" >> $GITHUB_OUTPUT
32+
done
33+
34+
- name: Get current date
35+
id: date
36+
run: echo "NOW=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
37+
38+
- uses: tsickert/discord-webhook@v5.3.0
39+
with:
40+
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
41+
username: IMPACTO
42+
avatar-url: https://cdn.discordapp.com/emojis/766988033127481344.png
43+
embed-title : "${{ github.event.commits[0].author.name }}"
44+
embed-color: 16711680
45+
embed-timestamp: ${{ steps.date.outputs.NOW }}
46+
embed-description: |
47+
Commit
48+
`${{ github.event.head_commit.message }} (${{ github.sha }})`
49+
from branch `${{ env.BRANCH_NAME }}` has failed build.
50+
51+
Job status:
52+
windows: ${{steps.get_jobs_status.outputs.windows}}
53+
linux: ${{steps.get_jobs_status.outputs.linux}}
54+
macos-arm64: ${{steps.get_jobs_status.outputs.macos-arm64}}
55+
macos-x64: ${{steps.get_jobs_status.outputs.macos-x64}}
56+
switch: ${{steps.get_jobs_status.outputs.switch}}
57+
android: ${{steps.get_jobs_status.outputs.android}}
58+
59+
Details:
60+
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.run_id }}

.github/workflows/publish.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: publish
2+
on:
3+
workflow_run:
4+
workflows: [impacto]
5+
types: [completed]
6+
branches:
7+
- master
8+
- v*
9+
jobs:
10+
publish_artifacts:
11+
name: Publish Artifacts
12+
runs-on: ubuntu-22.04
13+
permissions:
14+
contents: write
15+
if: github.event.workflow_run.conclusion.conclusion == 'success'
16+
steps:
17+
- uses: actions/download-artifact@v8
18+
with:
19+
name: VERSION
20+
github-token: ${{ secrets.GH_PAT }}
21+
run-id: github.event.workflow_run.id
22+
- name: Set version
23+
id: set-version
24+
run:
25+
- echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
26+
- uses: actions/download-artifact@v8
27+
with:
28+
pattern: release-*
29+
path: "${{ github.workspace }}/release"
30+
merge-multiple: true
31+
github-token: ${{ secrets.GH_PAT }}
32+
run-id: github.event.workflow_run.id
33+
- name: Upload Release
34+
uses: softprops/action-gh-release@v2
35+
with:
36+
Name: Latest ${{ env.BRANCH_NAME }} build
37+
tag_name: ${{ env.VERSION }}${{ github.event.workflow_run.run_number }}
38+
files:
39+
${{ github.workspace }}/release/*.zip
40+
prerelease: true
41+
fail_on_unmatched_files: true
42+
target_commitish: ${{ github.sha }}
43+
- name: Get current date
44+
id: date
45+
run: echo "NOW=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
46+
47+
- uses: tsickert/discord-webhook@v5.3.0
48+
with:
49+
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
50+
username: IMPACTO
51+
avatar-url: https://cdn.discordapp.com/emojis/766988033127481344.png
52+
embed-title : "${{ github.event.commits[0].author.name }}"
53+
embed-color: 3659647
54+
embed-timestamp: ${{ env.NOW }}
55+
embed-description: |
56+
Commit
57+
`${{ github.event.head_commit.message }} (${{ github.sha }})`
58+
from branch `${{ env.BRANCH_NAME }}` has been successfully built.
59+
60+
Release URL:
61+
https://github.com/CommitteeOfZero/impacto/releases/tag/${{ env.VERSION }}${{ github.event.workflow_run.run_number }}
62+
63+
Details:
64+
- Build: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}
65+
- Publish: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
66+

0 commit comments

Comments
 (0)