-
-
Notifications
You must be signed in to change notification settings - Fork 920
161 lines (144 loc) · 6.09 KB
/
publish.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
151
152
153
154
155
156
157
158
159
160
161
# Release workflow
#
# We parallelize builds, dump all the artifacts into a release, and then publish the release
# This guarantees everything is properly built and cached in case anything goes wrong
#
# The artifacts also need to get pushed to the various places
# - the CLI goes to the releases page for binstall
# - the extension goes to the marketplace
# - the docs go to the website
#
# We need to be aware of the channel we're releasing
# - prerelease is master
# - stable is whatever the latest stable release is (ie 0.4 or 0.5 or 0.6 etc)
#
# It's intended that this workflow is run manually, and only when we're ready to release
name: Publish CLI
on:
workflow_dispatch:
inputs:
post:
name: "Release Post"
required: true
description: Choose the release post to publish with. Must be a tag (eg v0.4.0)
type: string
channel:
name: "CLI Binary Version"
required: true
description: Choose the version number to publish with. Must be a tag (ie v0.4.0)
type: string
env:
# make sure we have the right version
# main is always a prepatch until we hit 1.0, and then this script needs to be updated
# note that we need to promote the prepatch to a minor bump when we actually do a release
# this means the version in git will always be one minor bump ahead of the actual release - basically meaning once
# we release a version, it's fair game to merge breaking changes to main since all semver-compatible changes will be
# backported automatically
# SEMVER: ${{ github.event.inputs.channel == 'main' && 'prerelease' || 'patch' }}
# PRERELEASE_TAG: ${{ github.event.inputs.channel == 'main' && '-pre' || '' }}
RELEASE_TAG: ${{ github.event.inputs.channel }}
RELEASE_POST: ${{ github.event.inputs.post }}
jobs:
release-cli:
permissions:
contents: write
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: aarch64-pc-windows-msvc
os: windows-latest
- target: x86_64-apple-darwin
os: macos-13
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
# - target: aarch64-unknown-linux-gnu
# os: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install openssl on macos
if: matrix.platform.os == 'macos-latest'
run: brew install openssl
- name: Install nasm for windows (tls)
if: ${{ matrix.platform.target == 'x86_64-pc-windows-msvc' }}
uses: ilammy/setup-nasm@v1
- name: Install stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.79.0"
targets: ${{ matrix.platform.target }}
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Free Disk Space
uses: jlumbroso/[email protected]
with: # speed things up a bit
large-packages: false
docker-images: false
swap-storage: false
# Todo: we want `cargo install dx` to actually just use a prebuilt binary instead of building it
- name: Build and upload CLI binaries
uses: taiki-e/upload-rust-binary-action@v1
with:
bin: dx
token: ${{ secrets.GITHUB_TOKEN }}
target: ${{ matrix.platform.target }}
archive: $bin-$target-${{ env.RELEASE_TAG }}
checksum: sha256
manifest_path: packages/cli/Cargo.toml
ref: refs/tags/${{ env.RELEASE_POST }}
features: wasm-opt
# todo: these things
# Run benchmarks, which we'll use to display on the website
# release-benchmarks:
# Build the vscode extension, uploading the artifact to the marketplace
# release-extension:
# First, run checks (clippy, tests, etc) and then publish the crates to crates.io
# release-crates:
# steps:
# # Checkout the right branch, and the nightly stuff
# - uses: actions/checkout@v4
# ref: ${{ github.event.inputs.channel }}
# - run: sudo apt-get update
# - run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
# - uses: dtolnay/rust-toolchain@nightly
# with:
# toolchain: nightly-2024-02-01
# - uses: Swatinem/rust-cache@v2
# with:
# cache-all-crates: "true"
# - name: Free Disk Space (Ubuntu)
# uses: jlumbroso/[email protected]
# with: # speed things up a bit
# large-packages: false
# docker-images: false
# swap-storage: false
# # Just make sure clippy is happy before doing anything else
# # Don't publish versions with clippy errors!
# - name: Clippy
# run: cargo clippy --workspace --all --examples --tests --all-features --all-targets -- -D warnings
# # Build the docs here too before publishing, to ensure they're up to date
# - name: cargo doc
# run: RUSTDOCFLAGS="--cfg docsrs" cargo doc --no-deps --workspace --all-features
# - name: Publish to crates.io
# run: |
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git config --global user.name "github-actions[bot]"
# cargo workspaces version -y ${{ env.SEMVER }} --pre-id rc --no-git-commit
# # todo: actually just publish!
# # cargo workspaces publish -y ${{ github.event.inputs.semver }}
# this will be more useful when we publish the website with updated docs
# Build the docs.rs docs and publish them to the website under the right folder
# v0.4.x -> docs/0.4
# v0.5.x -> docs/0.5 etc
# main -> docs/nightly
# strip the v from the channel, and the .x from the end, and replace main with nightly
# - name: determine docs folder by channel
# id: determine_docs_folder
# run: echo "::set-output name=folder::$(echo ${{ github.event.inputs.channel }} | sed 's/v//g' | sed 's/\.x//g' | sed 's/main/nightly/g')"