Skip to content

Commit f095919

Browse files
authored
Create build.yml
1 parent c93efb6 commit f095919

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/build.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
tags:
6+
- "*.*.*"
7+
8+
permissions:
9+
actions: read
10+
contents: write
11+
12+
jobs:
13+
validate:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Validate tag format
17+
run: |
18+
echo "Using tag: ${{ github.ref_name }}"
19+
if ! [[ "${{ github.ref_name }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
20+
echo "Tag format is invalid. Expected semantic versioning (e.g., 1.2.3)."
21+
exit 1
22+
fi
23+
24+
macos:
25+
runs-on: macos-latest
26+
strategy:
27+
matrix:
28+
arch:
29+
- arm64
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
repository: apple/swift-protobuf
34+
ref: ${{ github.ref_name }}
35+
- run: |
36+
swift build -c release
37+
mv .build/release/protoc-gen-swift protoc-gen-swift-macos-${{ matrix.arch }}
38+
- uses: actions/upload-artifact@v4
39+
with:
40+
name: protoc-gen-swift-macos-${{ matrix.arch }}
41+
path: protoc-gen-swift-macos-${{ matrix.arch }}
42+
linux:
43+
runs-on: ubuntu-latest
44+
strategy:
45+
matrix:
46+
arch:
47+
- amd64
48+
- arm64
49+
steps:
50+
- uses: actions/checkout@v4
51+
with:
52+
repository: apple/swift-protobuf
53+
ref: ${{ github.ref_name }}
54+
- run: |
55+
swift build -c release
56+
mv .build/release/protoc-gen-swift protoc-gen-swift-linux-${{ matrix.arch }}
57+
- uses: actions/upload-artifact@v4
58+
with:
59+
name: protoc-gen-swift-linux-${{ matrix.arch }}
60+
path: protoc-gen-swift-linux-${{ matrix.arch }}
61+
release:
62+
runs-on: ubuntu-latest
63+
needs:
64+
- macos
65+
- linux
66+
steps:
67+
- uses: actions/download-artifact@v4
68+
- run: ls -l; ls -l protoc-gen-swift-*
69+
- uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda
70+
with:
71+
files: '**/protoc-gen-swift-*'

0 commit comments

Comments
 (0)