-
Notifications
You must be signed in to change notification settings - Fork 1
172 lines (145 loc) · 4.93 KB
/
release.yml
File metadata and controls
172 lines (145 loc) · 4.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get version
id: get_version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref }}
draft: false
prerelease: false
generate_release_notes: true
# Allow updating existing releases
fail_on_unmatched_files: false
build:
needs: create-release
strategy:
matrix:
include:
# Linux x86_64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: ferrix
asset_name: ferrix-${{ needs.create-release.outputs.version }}-x86_64-linux
# Linux ARM64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact_name: ferrix
asset_name: ferrix-${{ needs.create-release.outputs.version }}-aarch64-linux
use_cross: true
# macOS x86_64
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: ferrix
asset_name: ferrix-${{ needs.create-release.outputs.version }}-x86_64-macos
# macOS ARM64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: ferrix
asset_name: ferrix-${{ needs.create-release.outputs.version }}-aarch64-macos
# Windows support disabled - requires named pipes instead of Unix domain sockets
# TODO: Implement Windows support with interprocess named pipes
# - os: windows-latest
# target: x86_64-pc-windows-msvc
# artifact_name: ferrix.exe
# asset_name: ferrix-${{ needs.create-release.outputs.version }}-x86_64-windows
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Install cross
if: matrix.use_cross == true
run: cargo install cross
- name: Build
run: |
if [ "${{ matrix.use_cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }}
else
cargo build --release --target ${{ matrix.target }}
fi
shell: bash
- name: Package
shell: bash
run: |
mkdir -p package/${{ matrix.asset_name }}
cp target/${{ matrix.target }}/release/${{ matrix.artifact_name }} package/${{ matrix.asset_name }}/
cp README.md LICENSE package/${{ matrix.asset_name }}/
cp -r docs package/${{ matrix.asset_name }}/
cp -r completions package/${{ matrix.asset_name }}/
cd package
tar czf ${{ matrix.asset_name }}.tar.gz ${{ matrix.asset_name }}
cd ..
- name: Upload Release Asset
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ github.ref_name }} ./package/${{ matrix.asset_name }}.tar.gz --clobber
docker:
needs: create-release
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/ferrix:${{ needs.create-release.outputs.version }}
${{ secrets.DOCKER_USERNAME }}/ferrix:latest
homebrew:
needs: [create-release, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update Homebrew Formula
run: |
# Update formula with actual checksums
# This would typically push to a homebrew tap repository
echo "Homebrew formula would be updated here"
publish-crate:
needs: create-release
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
continue-on-error: true