1 |
name: Releases |
2 |
on: |
3 |
push: |
4 |
branches: |
5 |
- main |
6 |
|
7 |
permissions: |
8 |
contents: write |
9 |
|
10 |
jobs: |
11 |
build: |
12 |
if: github.repository_owner == 'onesoft-sudo' |
13 |
|
14 |
strategy: |
15 |
matrix: |
16 |
os: [ubuntu-latest, macos-latest] |
17 |
|
18 |
runs-on: ${{ matrix.os }} |
19 |
|
20 |
steps: |
21 |
- uses: actions/checkout@v4 |
22 |
|
23 |
- name: Use Node.js 21.x |
24 |
uses: actions/setup-node@v4 |
25 |
with: |
26 |
node-version: 21.x |
27 |
|
28 |
- name: Install Programs, Libraries and Tools (Linux) |
29 |
run: | |
30 |
sudo apt update; |
31 |
sudo apt install build-essential libcurl4 libcurl4-gnutls-dev -y; |
32 |
if: matrix.os == 'ubuntu-latest' |
33 |
|
34 |
- name: Install Programs, Libraries and Tools (macOS) |
35 |
run: brew install curl pkg-config cairo pango libpng jpeg giflib librsvg |
36 |
if: matrix.os == 'macos-latest' |
37 |
|
38 |
- name: "Install Native Libraries" |
39 |
run: | |
40 |
git clone https://github.com/Cogmasters/concord; |
41 |
cd concord; |
42 |
make; |
43 |
sudo make install; |
44 |
cd ..; |
45 |
|
46 |
- name: "Build Native Libraries with GNU Make" |
47 |
run: make |
48 |
|
49 |
- name: "Build with BlazeBuild" |
50 |
run: ./blazew build |
51 |
|
52 |
- name: "Package the build output files" |
53 |
run: | |
54 |
OS="${{ matrix.os }}"; |
55 |
mkdir sudobot-release-${OS}; |
56 |
mv build sudobot-release-${OS}; |
57 |
mv src sudobot-release-${OS}; |
58 |
mkdir sudobot-release-${OS}/lib; |
59 |
mv lib/build sudobot-release-${OS}/lib/build; |
60 |
tar -cvzf sudobot-release-${OS}-incomplete.tar.gz sudobot-release-${OS}; |
61 |
|
62 |
- name: Upload Release Artifacts |
63 |
uses: actions/upload-artifact@v4 |
64 |
with: |
65 |
name: sudobot-release-${{ matrix.os }}-incomplete |
66 |
path: | |
67 |
./sudobot-release-${{ matrix.os }}-incomplete.tar.gz |
68 |
|
69 |
release: |
70 |
needs: [build] |
71 |
if: github.repository_owner == 'onesoft-sudo' |
72 |
runs-on: ubuntu-latest |
73 |
|
74 |
steps: |
75 |
- uses: actions/checkout@v4 |
76 |
|
77 |
- name: Prepare Git |
78 |
run: | |
79 |
echo "${{ secrets.COMMIT_GPG_KEY }}" > private.key |
80 |
gpg --import private.key |
81 |
rm -f private.key |
82 |
git config --global user.signingkey "6AE7B08C68169452" |
83 |
git config --global commit.gpgsign true |
84 |
|
85 |
- name: Conventional Release Action |
86 |
id: auto_release |
87 |
uses: onesoft-sudo/conventional-release-action@main |
88 |
with: |
89 |
version-json-file: "./package.json" |
90 |
git-user-name: "Conventional Release Action" |
91 |
git-user-email: [email protected] |
92 |
commit-message-format: "release: v%s [skip ci]" |
93 |
git-sign-off: true |
94 |
changelog-file: CHANGELOG.md |
95 |
changelog-format: markdown |
96 |
allowed-commit-types: feat,fix,refactor,perf,ci,build,test,revert,chore,release,deps |
97 |
|
98 |
- name: Download Linux Release Artifact |
99 |
uses: actions/download-artifact@v4 |
100 |
with: |
101 |
name: sudobot-release-ubuntu-latest-incomplete |
102 |
|
103 |
- name: Download macOS Release Artifact |
104 |
uses: actions/download-artifact@v4 |
105 |
with: |
106 |
name: sudobot-release-macos-latest-incomplete |
107 |
|
108 |
- name: Extract Artifacts |
109 |
run: | |
110 |
tar -xvzf sudobot-release-ubuntu-latest-incomplete.tar.gz; |
111 |
tar -xvzf sudobot-release-macos-latest-incomplete.tar.gz; |
112 |
|
113 |
- name: Rename Artifacts |
114 |
run: | |
115 |
mv sudobot-release-ubuntu-latest sudobot-release-linux; |
116 |
mv sudobot-release-macos-latest sudobot-release-darwin; |
117 |
|
118 |
- name: Add package.json to Incomplete Artifacts |
119 |
run: | |
120 |
cp package.json sudobot-release-linux/package.json; |
121 |
cp package.json sudobot-release-darwin/package.json; |
122 |
|
123 |
- name: Re-package Artifacts |
124 |
run: | |
125 |
tar -cvzf sudobot-release-linux.tar.gz sudobot-release-linux; |
126 |
tar -cvzf sudobot-release-darwin.tar.gz sudobot-release-darwin; |
127 |
|
128 |
- name: Create Release |
129 |
id: create_release |
130 |
uses: ncipollo/release-action@v1 |
131 |
if: ${{ steps.auto_release.outputs.tag != '' }} |
132 |
env: |
133 |
GITHUB_TOKEN: ${{ secrets.__TOKEN }} |
134 |
with: |
135 |
tag: ${{ steps.auto_release.outputs.tag }} |
136 |
name: ${{ steps.auto_release.outputs.tag }} |
137 |
body: ${{ steps.auto_release.outputs.release_notes }} |
138 |
artifactContentType: application/x-gzip |
139 |
artifacts: ./sudobot-release-linux.tar.gz,./sudobot-release-darwin.tar.gz |