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