Skip to content

Commit 6aa288c

Browse files
committed
Refactor GitHub Actions' workflow files
1 parent 0901dce commit 6aa288c

File tree

9 files changed

+227
-221
lines changed

9 files changed

+227
-221
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A workflow for notarizing macOS build artifacts during a CI workflow run.

.github/actions/notarize-macos/action.yml

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,18 @@ inputs:
2121
required: true
2222

2323
runs:
24-
using: 'composite'
24+
using: "composite"
2525

2626
steps:
2727
- name: Unlock keychain
28-
env:
29-
KEYCHAIN_PATH: ${{ inputs.KEYCHAIN_PATH }}
30-
KEYCHAIN_PW: ${{ inputs.KEYCHAIN_PW }}
3128
shell: bash
3229
run: |
33-
security unlock-keychain -p "$KEYCHAIN_PW" "$KEYCHAIN_PATH"
34-
security list-keychain -d user -s "$KEYCHAIN_PATH"
30+
security unlock-keychain -p "${{ inputs.KEYCHAIN_PW }}" "${{ inputs.KEYCHAIN_PATH}}"
31+
security list-keychain -d user -s "${{ inputs.KEYCHAIN_PATH }}"
32+
3533
- name: Include the dependencies in the app bundle
36-
env:
37-
DEV_ID: ${{ inputs.DEV_ID }}
3834
shell: bash
39-
run: find build -name "DB Browser for SQL*.app" -exec /opt/homebrew/opt/db4subqt@5/bin/macdeployqt {} -sign-for-notarization="$DEV_ID" \;
35+
run: find build -name "DB Browser for SQL*.app" -exec /opt/homebrew/opt/db4subqt@5/bin/macdeployqt {} -sign-for-notarization="${{ inputs.DEV_ID }}" \;
4036

4137
- name: Add the extension to the app bundle
4238
shell: bash
@@ -92,8 +88,6 @@ runs:
9288
done
9389
9490
- name: Copy the icon file to the app bundle
95-
env:
96-
DAILY: ${{ inputs.DAILY }}
9791
shell: bash
9892
run: |
9993
for TARGET in $(find build -name "DB Browser for SQL*.app" | sed -e 's/ /_/g'); do
@@ -108,16 +102,14 @@ runs:
108102
done
109103
110104
- name: Sign the manually added extensions.
111-
env:
112-
DEV_ID: ${{ inputs.DEV_ID }}
113105
shell: bash
114106
run: |
115107
for TARGET in $(find build -name "DB Browser for SQL*.app" | sed -e 's/ /_/g'); do
116108
TARGET=$(echo $TARGET | sed -e 's/_/ /g')
117-
codesign --sign "$DEV_ID" --deep --force --options=runtime --strict --timestamp "$TARGET/Contents/Extensions/fileio.dylib"
118-
codesign --sign "$DEV_ID" --deep --force --options=runtime --strict --timestamp "$TARGET/Contents/Extensions/formats.dylib"
119-
codesign --sign "$DEV_ID" --deep --force --options=runtime --strict --timestamp "$TARGET/Contents/Extensions/math.dylib"
120-
codesign --sign "$DEV_ID" --deep --force --options=runtime --strict --timestamp "$TARGET"
109+
codesign --sign "${{ inputs.DEV_ID }}" --deep --force --options=runtime --strict --timestamp "$TARGET/Contents/Extensions/fileio.dylib"
110+
codesign --sign "${{ inputs.DEV_ID }}" --deep --force --options=runtime --strict --timestamp "$TARGET/Contents/Extensions/formats.dylib"
111+
codesign --sign "${{ inputs.DEV_ID }}" --deep --force --options=runtime --strict --timestamp "$TARGET/Contents/Extensions/math.dylib"
112+
codesign --sign "${{ inputs.DEV_ID }}" --deep --force --options=runtime --strict --timestamp "$TARGET"
121113
done
122114
123115
- name: Move app bundle to installer folder for DMG creation
@@ -128,9 +120,6 @@ runs:
128120
# but Composite Actions do not support if statements for steps.
129121
# For more information, see https://github.com/actions/runner/blob/main/docs/adrs/0549-composite-run-steps.md
130122
- name: Create the DMG
131-
env:
132-
DAILY: ${{ inputs.DAILY }}
133-
DEV_ID: ${{ inputs.DEV_ID }}
134123
shell: bash
135124
run: |
136125
export DATE=$(date +%Y%m%d)
@@ -141,13 +130,13 @@ runs:
141130
sed -i "" 's/"DB Browser for SQLCipher Nightly.app"/"DB Browser for SQLCipher-dev-'$(git rev-parse --short --verify HEAD)'.app"/' installer/macos/sqlcipher-nightly.json
142131
TARGET="DB.Browser.for.SQLCipher-dev-$(git rev-parse --short --verify HEAD).dmg"
143132
appdmg --quiet installer/macos/sqlcipher-nightly.json "$TARGET"
144-
codesign --sign "$DEV_ID" --verbose --options=runtime --timestamp "$TARGET"
133+
codesign --sign "${{ inputs.DEV_ID }}" --verbose --options=runtime --timestamp "$TARGET"
145134
codesign -vvv --deep --strict --verbose=4 "$TARGET"
146135
else
147136
# Daily with SQLCipher
148137
TARGET="DB.Browser.for.SQLCipher-universal_$DATE.dmg"
149138
appdmg --quiet installer/macos/sqlcipher-nightly.json "$TARGET"
150-
codesign --sign "$DEV_ID" --verbose --options=runtime --timestamp "$TARGET"
139+
codesign --sign "${{ inputs.DEV_ID }}" --verbose --options=runtime --timestamp "$TARGET"
151140
codesign -vvv --deep --strict --verbose=4 "$TARGET"
152141
fi
153142
else
@@ -156,25 +145,21 @@ runs:
156145
sed -i "" 's/"DB Browser for SQLite Nightly.app"/"DB Browser for SQLite-dev-'$(git rev-parse --short --verify HEAD)'.app"/' installer/macos/nightly.json
157146
TARGET="DB.Browser.for.SQLite-dev-$(git rev-parse --short --verify HEAD).dmg"
158147
appdmg --quiet installer/macos/nightly.json "$TARGET"
159-
codesign --sign "$DEV_ID" --verbose --options=runtime --timestamp "$TARGET"
148+
codesign --sign "${{ inputs.DEV_ID }}" --verbose --options=runtime --timestamp "$TARGET"
160149
codesign -vvv --deep --strict --verbose=4 "$TARGET"
161150
else
162151
# Daily without SQLCipher
163152
TARGET="DB.Browser.for.SQLite-universal_$DATE.dmg"
164153
appdmg --quiet installer/macos/nightly.json "$TARGET"
165-
codesign --sign "$DEV_ID" --verbose --options=runtime --timestamp "$TARGET"
154+
codesign --sign "${{ inputs.DEV_ID }}" --verbose --options=runtime --timestamp "$TARGET"
166155
codesign -vvv --deep --strict --verbose=4 "$TARGET"
167156
fi
168157
fi
169158
170159
- name: Notarize the dmg
171-
env:
172-
APPLE_ID: ${{ inputs.APPLE_ID }}
173-
APPLE_PW: ${{ inputs.APPLE_PW }}
174-
TEAM_ID: ${{ inputs.TEAM_ID }}
175160
shell: bash
176-
run: xcrun notarytool submit *.dmg --apple-id "$APPLE_ID" --password "$APPLE_PW" --team-id "$TEAM_ID" --wait
161+
run: xcrun notarytool submit *.dmg --apple-id "${{ inputs.APPLE_ID }}" --password "${{ inputs.APPLE_PW }}" --team-id "${{ inputs.TEAM_ID }}" --wait
177162

178163
- name: Staple the notarization ticket
179164
shell: bash
180-
run: xcrun stapler staple *.dmg
165+
run: xcrun stapler staple *.dmg

.github/workflows/build-appimage.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@ on:
44
workflow_call:
55
workflow_dispatch:
66

7-
permissions:
8-
contents: write
9-
107
jobs:
118
build:
129
name: ${{ matrix.os }} - SQLCipher ${{ matrix.sqlcipher }}
1310
runs-on: ${{ matrix.os }}
1411
strategy:
15-
fail-fast: true
12+
fail-fast: false
1613
matrix:
1714
os: [ubuntu-20.04]
1815
sqlcipher: ["0", "1"]
@@ -61,9 +58,8 @@ jobs:
6158
export FILE=${FILE/SQLite/SQLCipher}
6259
mv DB_Browser_for_SQLite*.AppImage $FILE
6360
64-
- name: Release
65-
uses: softprops/action-gh-release@v1
61+
- name: Upload artifacts
62+
uses: actions/upload-artifact@v3
6663
with:
67-
files: DB_Browser_for_*.AppImage
68-
prerelease: true
69-
tag_name: continuous
64+
name: build-artifacts
65+
path: DB_Browser_for_*.AppImage

.github/workflows/build-macos.yml

Lines changed: 97 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,110 @@
11
name: Build - macOS
22

33
on:
4-
schedule:
5-
- cron: '0 0 * * *' # Every day at midnight (UTC)
6-
workflow_call:
7-
workflow_dispatch:
8-
inputs:
9-
assume-triggerd-by-schedule:
10-
description: 'Assume this workflow was triggered by the schedule'
11-
required: false
12-
type: boolean
13-
14-
permissions:
15-
contents: write
4+
schedule:
5+
- cron: "0 0 * * *" # Every day at midnight (UTC)
6+
workflow_call:
7+
workflow_dispatch:
8+
inputs:
9+
assume-triggerd-by-schedule:
10+
default: 'false'
11+
description: "Assume this workflow was triggered by the schedule"
12+
required: false
1613

1714
jobs:
18-
build:
19-
name: ${{ matrix.os }} - SQLCipher ${{ matrix.sqlcipher }}
20-
runs-on: ${{ matrix.os }}
21-
strategy:
22-
fail-fast: true
23-
matrix:
24-
os: [macos-13-runner]
25-
sqlcipher: ["0", "1"]
26-
env:
27-
DAILY: false
28-
steps:
29-
- name: Update dependency packages
30-
run: |
31-
brew update
32-
brew upgrade db4subopenssl@3-x86_64 db4subopenssl@3 db4subqt@5 db4subsqlcipher-x86_64 db4subsqlcipher db4subsqlitefts@5
33-
34-
- name: Set 'DAILY' environment variable
35-
run: |
36-
if [ "${{ github.event_name }}" = "schedule" ] || [ "${{ github.event.inputs.assume-triggerd-by-schedule }}" == "true" ]; then
37-
echo "DAILY=true" >> $GITHUB_ENV
38-
fi
39-
40-
- name: Checkout
41-
uses: actions/checkout@v4
15+
build:
16+
name: ${{ matrix.os }} - SQLCipher ${{ matrix.sqlcipher }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [macos-13-runner]
22+
sqlcipher: ["0", "1"]
23+
env:
24+
DAILY: false
25+
steps:
26+
- name: Update dependency packages
27+
run: |
28+
brew update
29+
brew upgrade db4subopenssl@3-x86_64 db4subopenssl@3 db4subqt@5 db4subsqlcipher-x86_64 db4subsqlcipher db4subsqlitefts@5
30+
31+
- name: Set 'DAILY' environment variable
32+
run: |
33+
if [ "${{ github.event_name }}" = "schedule" ] || [ "${{ github.event.inputs.assume-triggerd-by-schedule }}" = "true" ]; then
34+
echo "DAILY=true" >> $GITHUB_ENV
35+
fi
36+
37+
- name: Checkout
38+
uses: actions/checkout@v4
4239

43-
- if: env.DAILY == 'false'
44-
name: Configure build (Continuous)
45-
run: |
46-
if [ "${{ matrix.sqlcipher }}" = "1" ]; then
47-
sed -i "" 's/"DB Browser for SQLite"/"DB Browser for SQLCipher-dev-'$(git rev-parse --short --verify HEAD)'"/' CMakeLists.txt
48-
else
49-
sed -i "" 's/"DB Browser for SQLite"/"DB Browser for SQLite-dev-'$(git rev-parse --short --verify HEAD)'"/' CMakeLists.txt
50-
fi
51-
mkdir build && cd build
52-
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DcustomTap=1 -DENABLE_TESTING=ON -Dsqlcipher=${{ matrix.sqlcipher }} ..
40+
- if: env.DAILY == 'false'
41+
name: Configure build (Continuous)
42+
run: |
43+
if [ "${{ matrix.sqlcipher }}" = "1" ]; then
44+
sed -i "" 's/"DB Browser for SQLite"/"DB Browser for SQLCipher-dev-'$(git rev-parse --short --verify HEAD)'"/' CMakeLists.txt
45+
else
46+
sed -i "" 's/"DB Browser for SQLite"/"DB Browser for SQLite-dev-'$(git rev-parse --short --verify HEAD)'"/' CMakeLists.txt
47+
fi
48+
mkdir build && cd build
49+
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DcustomTap=1 -DENABLE_TESTING=ON -Dsqlcipher=${{ matrix.sqlcipher }} ..
5350
54-
- if: env.DAILY == 'true'
55-
name: Configure build (Daily)
56-
run: |
57-
if [ "${{ matrix.sqlcipher }}" = "1" ]; then
58-
sed -i "" 's/"DB Browser for SQLite"/"DB Browser for SQLCipher Nightly"/' CMakeLists.txt
59-
else
60-
sed -i "" 's/"DB Browser for SQLite"/"DB Browser for SQLite Nightly"/' CMakeLists.txt
61-
fi
62-
mkdir build && cd build
63-
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DcustomTap=1 -DENABLE_TESTING=ON -Dsqlcipher=${{ matrix.sqlcipher }} ..
51+
- if: env.DAILY == 'true'
52+
name: Configure build (Daily)
53+
run: |
54+
if [ "${{ matrix.sqlcipher }}" = "1" ]; then
55+
sed -i "" 's/"DB Browser for SQLite"/"DB Browser for SQLCipher Nightly"/' CMakeLists.txt
56+
else
57+
sed -i "" 's/"DB Browser for SQLite"/"DB Browser for SQLite Nightly"/' CMakeLists.txt
58+
fi
59+
mkdir build && cd build
60+
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DcustomTap=1 -DENABLE_TESTING=ON -Dsqlcipher=${{ matrix.sqlcipher }} ..
6461
65-
- name: Build
66-
working-directory: ./build
67-
run: ninja
62+
- name: Build
63+
working-directory: ./build
64+
run: ninja
6865

69-
- name: Tests
70-
working-directory: ./build
71-
run: ninja test
66+
- name: Tests
67+
working-directory: ./build
68+
run: ninja test
7269

73-
- name: Build Extension
74-
run: |
75-
clang -I /opt/homebrew/opt/db4subsqlitefts@5/include -L /opt/homebrew/opt/db4subsqlitefts@5/lib -fno-common -dynamiclib src/extensions/extension-formats.c
76-
clang -I /opt/homebrew/opt/db4subsqlitefts@5/include -L /opt/homebrew/opt/db4subsqlitefts@5/lib -fno-common -dynamiclib src/extensions/extension-functions.c
77-
curl -L -o src/extensions/fileio.c 'https://sqlite.org/src/raw?filename=ext/misc/fileio.c&ci=trunk'
78-
curl -L -o src/extensions/test_windirect.c 'https://sqlite.org/src/raw?filename=src/test_windirent.c&ci=trunk'
79-
curl -L -o src/extensions/test_windirect.h 'https://sqlite.org/src/raw?filename=src/test_windirent.h&ci=trunk'
80-
clang -I /opt/homebrew/opt/db4subsqlitefts@5/include -L /opt/homebrew/opt/db4subsqlitefts@5/lib -fno-common -dynamiclib src/extensions/fileio.c src/extensions/test_windirect.c
70+
- name: Build Extension
71+
run: |
72+
clang -I /opt/homebrew/opt/db4subsqlitefts@5/include -L /opt/homebrew/opt/db4subsqlitefts@5/lib -fno-common -dynamiclib src/extensions/extension-formats.c
73+
clang -I /opt/homebrew/opt/db4subsqlitefts@5/include -L /opt/homebrew/opt/db4subsqlitefts@5/lib -fno-common -dynamiclib src/extensions/extension-functions.c
74+
curl -L -o src/extensions/fileio.c 'https://sqlite.org/src/raw?filename=ext/misc/fileio.c&ci=trunk'
75+
curl -L -o src/extensions/test_windirect.c 'https://sqlite.org/src/raw?filename=src/test_windirent.c&ci=trunk'
76+
curl -L -o src/extensions/test_windirect.h 'https://sqlite.org/src/raw?filename=src/test_windirent.h&ci=trunk'
77+
clang -I /opt/homebrew/opt/db4subsqlitefts@5/include -L /opt/homebrew/opt/db4subsqlitefts@5/lib -fno-common -dynamiclib src/extensions/fileio.c src/extensions/test_windirect.c
8178
82-
- if: github.event_name != 'pull_request'
83-
name: Notarize the app
84-
uses: ./.github/actions/notarize-macos
85-
with:
86-
APPLE_ID: ${{ secrets.MACOS_CODESIGN_APPLE_ID }}
87-
APPLE_PW: ${{ secrets.MACOS_CODESIGN_APPLE_PW }}
88-
DAILY: ${{ env.DAILY }}
89-
DEV_ID: ${{ secrets.MACOS_CODESIGN_DEV_ID }}
90-
KEYCHAIN_PATH: ${{ secrets.MACOS_CODESIGN_KEYCHAIN_PATH }}
91-
KEYCHAIN_PW: ${{ secrets.MACOS_CODESIGN_KEYCHAIN_PW }}
92-
SQLCIPHER: ${{ matrix.sqlcipher }}
93-
TEAM_ID: ${{ secrets.MACOS_CODESIGN_TEAM_ID }}
79+
- if: github.event_name != 'pull_request'
80+
name: Notarize the app
81+
uses: ./.github/actions/notarize-macos
82+
with:
83+
APPLE_ID: ${{ secrets.MACOS_CODESIGN_APPLE_ID }}
84+
APPLE_PW: ${{ secrets.MACOS_CODESIGN_APPLE_PW }}
85+
DAILY: ${{ env.DAILY }}
86+
DEV_ID: ${{ secrets.MACOS_CODESIGN_DEV_ID }}
87+
KEYCHAIN_PATH: ${{ secrets.MACOS_CODESIGN_KEYCHAIN_PATH }}
88+
KEYCHAIN_PW: ${{ secrets.MACOS_CODESIGN_KEYCHAIN_PW }}
89+
SQLCIPHER: ${{ matrix.sqlcipher }}
90+
TEAM_ID: ${{ secrets.MACOS_CODESIGN_TEAM_ID }}
9491

95-
- if: github.event_name != 'pull_request' && env.DAILY == 'false'
96-
name: Release (Continuous)
97-
uses: softprops/action-gh-release@v1
98-
with:
99-
files: DB.Browser.for.*.dmg
100-
prerelease: true
101-
tag_name: continuous
92+
- if: github.event_name != 'pull_request' && env.DAILY == 'false'
93+
name: Upload artifacts (Continuous)
94+
uses: actions/upload-artifact@v3
95+
with:
96+
name: build-artifacts
97+
path: DB.Browser.for.*.dmg
10298

103-
- if: env.DAILY == 'true'
104-
name: Release (Daily)
105-
run: |
106-
export DATE=$(date +%Y%m%d)
107-
rsync -aP *.dmg ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }}:/nightlies/macos-universal/
108-
if [ "${{ matrix.sqlcipher }}" = "1" ]; then
109-
ssh -q ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }} "cd /nightlies/latest && rm -f *SQLC*-universal*dmg*"
110-
ssh -q ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }} "ln -s /nightlies/macos-universal/DB.Browser.for.SQLCipher-universal_$DATE.dmg /nightlies/latest/DB.Browser.for.SQLCipher-universal.dmg"
111-
else
112-
ssh -q ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }} "cd /nightlies/latest && rm -f *SQLi*-universal*dmg*"
113-
ssh -q ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }} "ln -s /nightlies/macos-universal/DB.Browser.for.SQLite-universal_$DATE.dmg /nightlies/latest/DB.Browser.for.SQLite-universal.dmg"
114-
fi
99+
- if: env.DAILY == 'true'
100+
name: Release (Daily)
101+
run: |
102+
export DATE=$(date +%Y%m%d)
103+
rsync -aP *.dmg ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }}:/nightlies/macos-universal/
104+
if [ "${{ matrix.sqlcipher }}" = "1" ]; then
105+
ssh -q ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }} "cd /nightlies/latest && rm -f *SQLC*-universal*dmg*"
106+
ssh -q ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }} "ln -s /nightlies/macos-universal/DB.Browser.for.SQLCipher-universal_$DATE.dmg /nightlies/latest/DB.Browser.for.SQLCipher-universal.dmg"
107+
else
108+
ssh -q ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }} "cd /nightlies/latest && rm -f *SQLi*-universal*dmg*"
109+
ssh -q ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }} "ln -s /nightlies/macos-universal/DB.Browser.for.SQLite-universal_$DATE.dmg /nightlies/latest/DB.Browser.for.SQLite-universal.dmg"
110+
fi

.github/workflows/build-ubuntu.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
name: Build - Ubuntu
22

33
on:
4+
release:
5+
types: [created]
46
workflow_call:
57
workflow_dispatch:
68

7-
permissions:
8-
contents: write
9-
109
jobs:
1110
build:
1211
name: ${{ matrix.os }} - SQLCipher ${{ matrix.sqlcipher }}
1312
runs-on: ${{ matrix.os }}
1413
strategy:
15-
fail-fast: true
14+
fail-fast: false
1615
matrix:
1716
os: [ubuntu-20.04]
1817
sqlcipher: ["0", "1"]
@@ -58,4 +57,4 @@ jobs:
5857
NAME=$(basename $pkg)
5958
MIME=$(file --mime-type $pkg|cut -d ' ' -f2)
6059
curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: $MIME" --data-binary @$pkg $UPLOAD_URL?name=$NAME
61-
done
60+
done

0 commit comments

Comments
 (0)