Skip to content

Commit f9acf20

Browse files
authored
Merge pull request #4 from Shopify/ah.add-binary-release
Add binary release
2 parents ff8aef2 + dc50c43 commit f9acf20

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed

.github/workflows/publish.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
jobs:
9+
compile:
10+
name: Compile
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
include:
15+
- name: linux
16+
os: ubuntu-latest
17+
path: target/release/script-runner
18+
asset_name: script-runner-x86_64-linux-${{ github.event.release.tag_name }}
19+
shasum_cmd: sha256sum
20+
- name: macos
21+
os: macos-latest
22+
path: target/release/script-runner
23+
asset_name: script-runner-x86_64-macos-${{ github.event.release.tag_name }}
24+
shasum_cmd: shasum -a 256
25+
- name: windows
26+
os: windows-latest
27+
path: target\release\script-runner.exe
28+
asset_name: script-runner-x86_64-windows-${{ github.event.release.tag_name }}
29+
shasum_cmd: sha256sum
30+
31+
steps:
32+
- uses: actions/checkout@v1
33+
34+
- name: Install Rust
35+
uses: actions-rs/toolchain@v1
36+
with:
37+
profile: default
38+
toolchain: 1.59.0
39+
default: true
40+
41+
- name: Build ${{ matrix.os }}
42+
run: cargo build --release --package script-runner
43+
44+
- name: Archive assets
45+
run: gzip -k -f ${{ matrix.path }} && mv ${{ matrix.path }}.gz ${{ matrix.asset_name }}.gz
46+
47+
- name: Upload assets to artifacts
48+
uses: actions/upload-artifact@v2
49+
with:
50+
name: ${{ matrix.asset_name }}.gz
51+
path: ${{ matrix.asset_name }}.gz
52+
53+
- name: Upload assets to release
54+
uses: actions/upload-release-asset@v1
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
with:
58+
upload_url: ${{ github.event.release.upload_url }}
59+
asset_path: ./${{ matrix.asset_name }}.gz
60+
asset_name: ${{ matrix.asset_name }}.gz
61+
asset_content_type: application/gzip
62+
63+
- name: Generate asset hash
64+
run: ${{ matrix.shasum_cmd }} ${{ matrix.asset_name }}.gz | awk '{ print $1 }' > ${{ matrix.asset_name }}.gz.sha256
65+
66+
- name: Upload asset hash to artifacts
67+
uses: actions/upload-artifact@v2
68+
with:
69+
name: ${{ matrix.asset_name }}.gz.sha256
70+
path: ${{ matrix.asset_name }}.gz.sha256
71+
72+
- name: Upload asset hash to release
73+
uses: actions/upload-release-asset@v1
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
with:
77+
upload_url: ${{ github.event.release.upload_url }}
78+
asset_path: ./${{ matrix.asset_name }}.gz.sha256
79+
asset_name: ${{ matrix.asset_name }}.gz.sha256
80+
asset_content_type: plain/text

CONTRIBUTING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Release
2+
3+
1. From the `main` branch, create a new tag for the new version with the format `v{version_number}` (e.g. `v0.1.0`). This should match the version number in `Cargo.toml`.
4+
5+
```sh
6+
git tag tag v0.1.0
7+
git push origin --tags
8+
```
9+
10+
2. Create a new Github release [here](https://github.com/Shopify/script-runner/releases/new).
11+
3. When the release is created, the Github action defined in `publish.yml` will be run. This will produce the build artifacts for script-runner, except for `arm-macos` (e.g. M1 Macs).
12+
4. Build `script-runner` on an ARM Mac (e.g. M1 Mac)
13+
14+
```sh
15+
gzip -k -f target/release/script-runner && mv target/release/script-runner.gz script-runner-arm-macos-v0.1.0.gz
16+
```
17+
18+
5. Create the shasum file
19+
20+
```sh
21+
shasum -a 256 script-runner-arm-macos-v0.2.0.gz | awk '{ print $1 }' > script-runner-arm-macos-v0.2.0.gz.sha256
22+
```
23+
24+
6. Attach the build and shasum to the release created in step 2.

0 commit comments

Comments
 (0)