Skip to content

Commit 63e5ec2

Browse files
committed
* Add main.yml
1 parent 6d82bee commit 63e5ec2

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build and Update
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- '**.c'
8+
- '**.h'
9+
- '**/CMakeLists.txt'
10+
- '.github/workflows/**'
11+
pull_request:
12+
paths:
13+
- '**.c'
14+
- '**.h'
15+
- '**/CMakeLists.txt'
16+
- '.github/workflows/**'
17+
18+
jobs:
19+
freebsd:
20+
uses: ./.github/workflows/freebsd_build.yml
21+
with:
22+
ring-version: v1.23
23+
24+
macos:
25+
uses: ./.github/workflows/macos_build.yml
26+
with:
27+
ring-version: v1.23
28+
29+
ubuntu:
30+
uses: ./.github/workflows/ubuntu_build.yml
31+
with:
32+
ring-version: v1.23
33+
34+
windows:
35+
uses: ./.github/workflows/windows_build.yml
36+
with:
37+
ring-version: v1.23
38+
39+
update-libs:
40+
runs-on: ubuntu-latest
41+
needs: [ freebsd, macos, ubuntu, windows ]
42+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
43+
44+
permissions:
45+
contents: write
46+
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@v4
50+
51+
- name: Download all artifacts from this workflow run
52+
uses: actions/download-artifact@v4
53+
with:
54+
path: artifacts
55+
56+
- name: Copy artifacts to lib directory
57+
run: |
58+
mkdir -p lib
59+
for artifact_dir in artifacts/*/; do
60+
if [ -d "$artifact_dir" ]; then
61+
cp -a "${artifact_dir}." "lib/"
62+
fi
63+
done
64+
65+
- name: Commit and push changes
66+
run: |
67+
git config --global user.name 'github-actions[bot]'
68+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
69+
git add lib
70+
if ! git diff --staged --quiet; then
71+
git commit -m "Update libs from all builds"
72+
git push
73+
else
74+
echo "No library changes to commit."
75+
fi
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)