Skip to content

Commit daec867

Browse files
committed
Release workflow
1 parent 5e40e51 commit daec867

2 files changed

Lines changed: 93 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
build:
10+
name: Build for ${{ matrix.destination.name }}
11+
runs-on: ${{ matrix.destination.os }}
12+
strategy:
13+
matrix:
14+
destination:
15+
- { name: "ubuntu-aarch64", os: ubuntu-22.04-arm }
16+
- { name: "ubuntu-x86_64", os: ubuntu-22.04 }
17+
- { name: "macos-universal", os: macos-15 }
18+
steps:
19+
- if: startsWith(matrix.destination.name, 'ubuntu')
20+
uses: vapor/swiftly-action@v0.2
21+
with:
22+
toolchain: 6.1.0
23+
- if: startsWith(matrix.destination.name, 'macos')
24+
run: sudo xcode-select -s /Applications/Xcode_16.4.app
25+
- uses: actions/checkout@v4
26+
- name: Create the binary
27+
run: make release OUTPUT_NAME=puresql.${{ matrix.destination.name }}.tar.gz
28+
- name: Upload the binary
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: puresql.${{ matrix.destination.name }}.tar.gz
32+
path: puresql.${{ matrix.destination.name }}.tar.gz
33+
34+
make-artifact-bundle:
35+
needs: [build]
36+
runs-on: ubuntu-latest
37+
outputs:
38+
checksum: ${{ steps.checksum.outputs.checksum }}
39+
steps:
40+
- uses: actions/checkout@v4
41+
- name: Download all artifacts
42+
uses: actions/download-artifact@v4
43+
with:
44+
merge-multiple: true
45+
- run: bundle/make_artifactbundle.sh ${{ github.event.release.tag_name || github.ref_name }}
46+
- name: Upload artifact bundle
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: puresql.artifactbundle.zip
50+
path: puresql.artifactbundle.zip
51+
- name: Compute checksum
52+
id: checksum
53+
run: echo "checksum=$(swift package compute-checksum puresql.artifactbundle.zip)" >> "$GITHUB_OUTPUT"
54+
55+
deploy-binary:
56+
if: ${{ github.event_name == 'release' }}
57+
needs: [make-artifact-bundle]
58+
runs-on: ubuntu-latest
59+
steps:
60+
- uses: actions/download-artifact@v4
61+
with:
62+
merge-multiple: true
63+
- name: Deploy the binary
64+
uses: softprops/action-gh-release@v2
65+
with:
66+
files: |
67+
puresql.ubuntu-x86_64.tar.gz
68+
puresql.ubuntu-aarch64.tar.gz
69+
puresql.macos-universal.tar.gz
70+
puresql.artifactbundle.zip

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.PHONY: build zip release
2+
3+
UNAME_S := $(shell uname -s)
4+
BUILD_FLAGS :=
5+
BUILD_DIR :=
6+
OUTPUT_NAME ?= build.tar.gz
7+
8+
ifeq ($(UNAME_S),Darwin)
9+
BUILD_FLAGS := -c release --product PureSQLCLI --arch arm64 --arch x86_64
10+
BUILD_DIR := .build/release
11+
else
12+
BUILD_FLAGS := -c release --product PureSQLCLI
13+
BUILD_DIR := .build/apple/Products/Release
14+
endif
15+
16+
build:
17+
@swift build $(BUILD_FLAGS)
18+
19+
zip:
20+
cp $(BUILD_DIR)/PureSQLCLI puresql
21+
tar -cvzf $(OUTPUT_NAME) puresql
22+
23+
release: build zip

0 commit comments

Comments
 (0)