Skip to content

Commit 65ccff5

Browse files
committed
add the github actions workflow
1 parent 230aca0 commit 65ccff5

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

.github/workflows/build.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build
2+
on: [push]
3+
jobs:
4+
build:
5+
strategy:
6+
fail-fast: false
7+
matrix:
8+
include:
9+
- arch: x86_64
10+
- arch: arm64
11+
runs-on: macos-13
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
- name: Build
16+
run: ./build.sh ${{ matrix.arch }}
17+
- name: Archive binary
18+
uses: actions/upload-artifact@v3
19+
with:
20+
name: dockutil-${{ matrix.arch }}
21+
path: |
22+
.build/dockutil-${{ matrix.arch }}.tar.gz
23+
release:
24+
if: startsWith(github.ref, 'refs/tags/v')
25+
runs-on: ubuntu-22.04
26+
needs:
27+
- build
28+
permissions:
29+
contents: write
30+
steps:
31+
- name: Download artifacts
32+
uses: actions/download-artifact@v3
33+
- name: Release
34+
uses: ncipollo/release-action@v1
35+
with:
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
draft: true
38+
artifacts: |
39+
.build/*.tar.gz

build.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
#!/bin/bash
2+
set -euo pipefail
23

3-
swift build -c release
4+
ARCH="${1:-x86_64}"
5+
6+
# build.
7+
swift build \
8+
--arch "$ARCH" \
9+
--configuration release
10+
11+
# package.
12+
rm -f ".build/dockutil-$ARCH.tar.gz"
13+
tar czf ".build/dockutil-$ARCH.tar.gz" \
14+
-C ".build/$ARCH-apple-macosx/release" \
15+
dockutil

0 commit comments

Comments
 (0)