-
Notifications
You must be signed in to change notification settings - Fork 589
132 lines (119 loc) · 4.1 KB
/
release.yml
File metadata and controls
132 lines (119 loc) · 4.1 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
name: Build & Release
on:
push:
branches:
- main
jobs:
version:
outputs:
version: ${{ steps.echo.outputs.version }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: bazelbuild/setup-bazelisk@v2
- name: Cache
id: cache
uses: actions/cache@v2
with:
path: ~/bazel-disk-cache
key: capnp-cache
- name: build capnp
run: |
bazel build --disk_cache=~/bazel-disk-cache --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev @capnp-cpp//src/capnp:capnp_tool
- id: echo
run: |
echo "::set-output name=version::1.$(bazel-bin/external/capnp-cpp/src/capnp/capnp_tool eval src/workerd/io/compatibility-date.capnp supportedCompatibilityDate | tr -d '-' | tr -d '"').0"
build:
strategy:
matrix:
os: [ubuntu-22.04, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: bazelbuild/setup-bazelisk@v2
- name: Cache
id: cache
uses: actions/cache@v2
with:
path: ~/bazel-disk-cache
key: ${{ runner.os }}-${{ runner.arch }}-bazel-disk-cache
- name: install dependencies
if: ${{ runner.os == 'Linux' }}
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y build-essential git clang libc++-dev
- name: build
run: |
bazel build --disk_cache=~/bazel-disk-cache --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev -c opt //src/workerd/server:workerd
- name: Upload binary
uses: actions/upload-artifact@v3.1.0
with:
name: ${{ runner.os }}-${{ runner.arch }}-binary
path: bazel-bin/src/workerd/server/workerd
check-tag:
name: Check tag is new
outputs:
exists: ${{ steps.check_tag.outputs.exists }}
needs: [version, build]
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: mukunku/tag-exists-action@v1.1.0
id: check_tag
with:
tag: v${{ needs.version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag-and-release:
name: Tag & Release
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
needs: [check-tag, version, build]
runs-on: ubuntu-latest
if: needs.check-tag.outputs.exists != 'true'
steps:
- run: echo ${{ needs.check-tag.outputs.exists }}
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git tag v${{ needs.version.outputs.version }} && git push origin v${{ needs.version.outputs.version }}
- uses: ncipollo/release-action@v1
id: create_release
with:
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
tag: v${{ needs.version.outputs.version }}
upload-artifacts:
name: Upload Artifacts
needs: [tag-and-release]
runs-on: ubuntu-latest
strategy:
matrix:
arch: [linux-64, darwin-64]
include:
- arch: linux-64
name: Linux-X64
- arch: darwin-64
name: macOS-X64
steps:
- name: Download ${{ matrix.name }}
uses: actions/download-artifact@v3.0.0
with:
name: ${{ matrix.name }}-binary
path: /tmp
- run: mv /tmp/workerd /tmp/workerd-${{ matrix.arch }}
- run: chmod +x /tmp/workerd-${{ matrix.arch }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.tag-and-release.outputs.upload_url }}
asset_path: /tmp/workerd-${{ matrix.arch }}
asset_name: workerd-${{ matrix.arch }}
asset_content_type: application/octet-stream