-
-
Notifications
You must be signed in to change notification settings - Fork 3
150 lines (136 loc) · 4.54 KB
/
release.yml
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# mostly copied from https://raw.githubusercontent.com/web-infra-dev/oxc/main/.github/workflows/release_cli.yml
name: release
on:
workflow_run:
workflows: [test]
types: [completed]
branches: [main]
workflow_dispatch:
concurrency:
group: "release"
cancel-in-progress: true
permissions:
contents: write
id-token: write
jobs:
tag:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- name: Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -fa canary -m "Latest Continuous Release" ${GITHUB_SHA}
git push --force origin canary:refs/tags/canary
build:
if: |
${{
github.event_name == 'workflow_dispatch' ||
(
github.event.workflow_run.conclusion == 'success' &&
github.repository_owner == 'keithamus' &&
github.ref_name == 'main'
)
}}
strategy:
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
code-target: win32-x64
- os: windows-latest
target: aarch64-pc-windows-msvc
code-target: win32-arm64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
code-target: linux-x64
- os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
code-target: linux-arm64
- os: macos-latest
target: x86_64-apple-darwin
code-target: darwin-x64
- os: macos-latest
target: aarch64-apple-darwin
code-target: darwin-arm64
name: Package ${{ matrix.code-target }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: rustup target add ${{ matrix.target }}
- name: Install arm64 toolchain
if: matrix.code-target == 'linux-arm64'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: release-${{ matrix.target }}
- name: Build Binary
# strip debug symbols from std, see https://github.com/johnthagen/min-sized-rust#remove-panic-string-formatting-with-panic_immediate_abort
run: cargo build --release --target ${{ matrix.target }} -p hdx
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Archive Binary
if: runner.os == 'Windows'
shell: bash
run: |
BIN_NAME=hdx-${{ matrix.code-target }}
mv target/${{ matrix.target }}/release/hdx.exe $BIN_NAME.exe
- name: Archive Binary
if: runner.os != 'Windows'
run: |
BIN_NAME=hdx-${{ matrix.code-target }}
mv target/${{ matrix.target }}/release/hdx $BIN_NAME
- run: chmod +x hdx-*
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: binary-${{ matrix.code-target }}
path: hdx-*
deploy:
env:
TAG_NAME: ${{ format('0.0.0-canary.{0}', github.SHA) }}
DIST_TAG: canary
runs-on: ubuntu-latest
needs: [build]
steps:
- run: echo "TAG_NAME=$TAG_NAME"; echo "DIST_TAG=$DIST_TAG"
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: 18.x
cache-dependency-path: ./website/package.json
cache: "npm"
- name: Download Artifacts
uses: actions/download-artifact@v4
- run: cp binary-*/* packages/hdx/bin
- run: tree
- run: npm i
working-directory: ./packages/hdx
- run: npm version ${TAG_NAME} --no-git-tag-version
working-directory: ./packages/hdx
- run: npm whoami; npm pub --provenance --tag $DIST_TAG --access public
working-directory: ./packages/hdx
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Update Release
uses: softprops/action-gh-release@v2
with:
name: Canary
prerelease: true
tag_name: canary
target_commitish: ${{ github.sha }}
files: binary-*/*
token: ${{ secrets.GITHUB_TOKEN }}
body: |
This release is automatically built and generated on every commit to main that passes tests.
And is currently published to npm:
```shell
npm i hdx@canary
```