-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (127 loc) · 3.82 KB
/
main.yaml
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
name: Build, Test and Release
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Mise Tools install
uses: jdx/mise-action@v2
with:
version: 2024.3.1
install: true
cache: true
experimental: true
- name: Test
run: |
bun install
bun test:ci
build:
needs: test
name: build-${{matrix.name}}
runs-on: ${{matrix.runs-on}}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu
name: linux-x64
target: x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
- os: ubuntu
name: linux-arm64
target: aarch64-unknown-linux-gnu
runs-on: ubuntu-latest
- os: macos
name: macos-x64
target: x86_64-apple-darwin
runs-on: macos-14
- os: macos
name: macos-arm64
target: aarch64-apple-darwin
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Mise Tools install
uses: jdx/mise-action@v2
with:
version: 2024.3.1
install: true
cache: true
experimental: true
- run: bun install
- name: Create binary and release files
run: |
mkdir -p ./dist/${{ matrix.name }}
bun build ./lib/main.ts --compile --outfile ./dist/${{ matrix.name }}/scfz
# FIXME: Bun issue with bin path
./lib/scfz --version
mv ./lib/scfz ./dist/${{ matrix.name }}/scfz
cd ./dist
tar -czvf scfz-${{ matrix.name }}.tar.gz ./${{ matrix.name }}/
cd ..
# TODO: Checksums
- uses: actions/upload-artifact@v4
with:
name: tarball-${{matrix.target}}
path: |
./dist/scfz-*.tar.gz
if-no-files-found: error
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Mise Tools install
uses: jdx/mise-action@v2
with:
version: 2024.3.1
install: true
cache: true
experimental: true
- run: bun install
- name: Create changelog
run: |
mkdir ./dist
bun changelog --file ./dist/changelog.txt --tag $(git tag --list --sort=v:refname | grep -v beta | tail -n 1)
cat ./dist/changelog.txt
- uses: actions/download-artifact@v4
if: startsWith(github.ref, 'refs/tags/')
with:
path: ./dist
- run: scripts/release.sh
if: startsWith(github.ref, 'refs/tags/')
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: ${{contains(github.ref, '-beta')}}
body_path: ./dist/changelog.txt
files: ./dist/releases/${{github.ref_name}}/*
- run: |
mkdir -p assets
mv dist/releases/install.sh assets/install.sh
if: startsWith(github.ref, 'refs/tags/')
- uses: stefanzweifel/git-auto-commit-action@v5
if: startsWith(github.ref, 'refs/tags/')
with:
commit_message: Updated install script
branch: gh-pages
commit_options: '--no-verify --signoff'
file_pattern: 'assets/install.sh'
repository: .
commit_user_name: GitHub Actions Bot # defaults to "github-actions[bot]"
status_options: '--untracked-files=no'
add_options: '-u'
push_options: '--force'
skip_dirty_check: true
skip_fetch: true
skip_checkout: true
disable_globbing: true
create_branch: false