88 - ' v*'
99
1010jobs :
11- build :
11+ build-linux :
1212 runs-on : ubuntu-latest
1313 permissions :
1414 contents : write
1515 packages : write
16+ outputs :
17+ version : ${{ steps.package-version.outputs.current-version }}
1618
1719 steps :
1820 - uses : actions/checkout@v6
1921
20- - uses : docker/login-action@v3
22+ - uses : docker/login-action@v4
2123 with :
2224 username : ${{ secrets.DOCKERHUB_USERNAME }}
2325 password : ${{ secrets.DOCKERHUB_TOKEN }}
2426
25- - uses : docker/login-action@v3
27+ - uses : docker/login-action@v4
2628 with :
2729 registry : ghcr.io
2830 username : ${{ github.actor }}
3335 with :
3436 path : frontend
3537
36- - uses : docker/build-push-action@v6
38+ - uses : docker/build-push-action@v7
3739 id : build
3840 with :
3941 context : .
@@ -51,20 +53,110 @@ jobs:
5153 docker rm extract
5254 chmod +x ./mailfang-linux-amd64
5355
54- - name : prepare release notes from changelog
56+ - name : Upload Linux binary
57+ uses : actions/upload-artifact@v6
58+ with :
59+ name : mailfang-linux-amd64
60+ path : ./mailfang-linux-amd64
61+ if-no-files-found : error
62+
63+ build-macos :
64+ runs-on : macos-latest
65+ strategy :
66+ matrix :
67+ include :
68+ - target : x86_64-apple-darwin
69+ asset : macos-x86_64
70+ - target : aarch64-apple-darwin
71+ asset : macos-arm64
72+
73+ steps :
74+ - uses : actions/checkout@v6
75+
76+ - uses : actions/setup-node@v6
77+ with :
78+ node-version : 24
79+ cache : npm
80+ cache-dependency-path : frontend/package-lock.json
81+
82+ - name : Build frontend
83+ working-directory : frontend
5584 run : |
56- # Extract first version block (newest) from CHANGELOG.md
57- awk 'found && /^## [0-9]/ { exit } /^## [0-9]/ { found=1 } found' CHANGELOG.md > release_notes.txt
85+ npm ci
86+ npm run build
5887
59- - name : create and publish release
60- env :
61- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
88+ - name : Install Rust toolchain (rustup)
89+ run : |
90+ rustup toolchain install stable
91+ rustup target add "${{ matrix.target }}"
92+
93+ - name : Build MailFang binary (macOS)
6294 run : |
63- VERSION="${{ steps.package-version.outputs.current-version }}"
64- gh release create "v${VERSION}" \
65- ./mailfang-linux-amd64 \
66- --title "v${VERSION}" \
67- --notes-file release_notes.txt
95+ cd backend
96+ cargo build --release --features embed-frontend --target "${{ matrix.target }}"
97+ cp "target/${{ matrix.target }}/release/mailfang" "../mailfang-${{ matrix.asset }}"
98+ chmod +x "../mailfang-${{ matrix.asset }}"
99+
100+ - name : Upload macOS binary
101+ uses : actions/upload-artifact@v6
102+ with :
103+ name : mailfang-${{ matrix.asset }}
104+ path : ./mailfang-${{ matrix.asset }}
105+ if-no-files-found : error
106+
107+ create-release :
108+ runs-on : ubuntu-latest
109+ needs :
110+ - build-linux
111+ - build-macos
112+ permissions :
113+ contents : write
114+ env :
115+ TAG : v${{ needs.build-linux.outputs.version }}
116+
117+ steps :
118+ - uses : actions/checkout@v6
119+
120+ - name : Download Linux binary
121+ uses : actions/download-artifact@v8
122+ with :
123+ name : mailfang-linux-amd64
124+ path : dist/mailfang-linux-amd64
125+
126+ - name : Download macOS Intel binary
127+ uses : actions/download-artifact@v8
128+ with :
129+ name : mailfang-macos-x86_64
130+ path : dist/mailfang-macos-x86_64
131+
132+ - name : Download macOS Apple Silicon binary
133+ uses : actions/download-artifact@v8
134+ with :
135+ name : mailfang-macos-arm64
136+ path : dist/mailfang-macos-arm64
137+
138+ - name : Extract changelog for release body
139+ id : changelog
140+ run : |
141+ BODY="$(awk 'found && /^## [0-9]/ { exit } /^## [0-9]/ { found=1 } found' CHANGELOG.md | sed '/^[[:space:]]*$/d')"
142+ echo "body<<EOF" >> "$GITHUB_OUTPUT"
143+ echo "$BODY" >> "$GITHUB_OUTPUT"
144+ echo "EOF" >> "$GITHUB_OUTPUT"
145+
146+ - name : Create or update GitHub Release
147+ uses : ncipollo/release-action@v1
148+ env :
149+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
150+ with :
151+ tag : ${{ env.TAG }}
152+ name : ${{ env.TAG }}
153+ body : ${{ steps.changelog.outputs.body }}
154+ artifacts : |
155+ dist/mailfang-linux-amd64/mailfang-linux-amd64
156+ dist/mailfang-macos-x86_64/mailfang-macos-x86_64
157+ dist/mailfang-macos-arm64/mailfang-macos-arm64
158+ allowUpdates : true
159+ replacesArtifacts : true
68160
69161 - name : deploy
70162 run : |
0 commit comments