Skip to content

Commit a7de080

Browse files
committed
Fixing up release workflow
1 parent 4336877 commit a7de080

File tree

2 files changed

+28
-182
lines changed

2 files changed

+28
-182
lines changed

.github/workflows/turborepo-release.yml

+20-181
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ name: Turborepo Release
1414

1515
env:
1616
CARGO_PROFILE_RELEASE_LTO: true
17-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
18-
RELEASE_TURBO_CLI: true # TODO: do we need this?
17+
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1918

2019
on:
2120
workflow_dispatch:
@@ -38,7 +37,7 @@ on:
3837
type: boolean
3938

4039
jobs:
41-
stage:
40+
bump-version:
4241
runs-on: ubuntu-latest
4342
steps:
4443
- uses: actions/checkout@v3
@@ -52,25 +51,15 @@ jobs:
5251
- name: Version
5352
run: |
5453
./scripts/version.js ${{ inputs.increment }}
55-
cat version.txt
56-
- name: Stage Commit
57-
id: stage
58-
run: cd cli && make stage-release && echo "STAGE_BRANCH=$(git branch --show-current)" >> $GITHUB_OUTPUT
59-
- name: Show Stage Commit
60-
run: echo "${{ steps.stage.outputs.STAGE_BRANCH }}"
54+
echo "VERSION=$(cat version.txt)" >> $GITHUB_OUTPUT
6155
outputs:
62-
stage-branch: "${{ steps.stage.outputs.STAGE_BRANCH }}"
56+
version: "${{ steps.bump-version.outputs.VERSION }}"
6357

6458
rust-smoke-test:
6559
name: Rust Unit Tests
6660
runs-on: ubuntu-latest
67-
needs: [stage]
61+
needs: [bump-version]
6862
steps:
69-
- name: Show Stage Commit
70-
run: echo "${{ needs.stage.outputs.stage-branch }}"
71-
- uses: actions/checkout@v3
72-
with:
73-
ref: ${{ needs.stage.outputs.stage-branch }}
7463
- name: Setup Turborepo Environment
7564
uses: ./.github/actions/setup-turborepo-environment
7665
with:
@@ -82,13 +71,8 @@ jobs:
8271
js-smoke-test:
8372
name: JS Package Tests
8473
runs-on: ubuntu-latest
85-
needs: [stage]
74+
needs: [bump-version]
8675
steps:
87-
- name: Show Stage Commit
88-
run: echo "${{ needs.stage.outputs.stage-branch }}"
89-
- uses: actions/checkout@v3
90-
with:
91-
ref: ${{ needs.stage.outputs.stage-branch }}
9276
- name: Setup Turborepo Environment
9377
uses: ./.github/actions/setup-turborepo-environment
9478
with:
@@ -98,168 +82,23 @@ jobs:
9882
uses: ./.github/actions/install-global-turbo
9983
- name: Run JS Package Tests
10084
run: turbo run check-types test --filter="./packages/*" --color
101-
102-
build-rust:
103-
name: "Build Rust"
104-
needs: [stage, rust-smoke-test, js-smoke-test]
105-
strategy:
106-
fail-fast: false
107-
matrix:
108-
settings:
109-
- host: macos-latest
110-
target: "x86_64-apple-darwin"
111-
container-options: "--rm"
112-
- host: macos-latest
113-
target: "aarch64-apple-darwin"
114-
container-options: "--rm"
115-
- host: ubuntu-latest
116-
container: ubuntu:xenial
117-
container-options: "--platform=linux/amd64 --rm"
118-
container-setup: "apt-get update && apt-get install -y curl musl-tools sudo unzip"
119-
target: "x86_64-unknown-linux-musl"
120-
setup: "apt-get install -y build-essential clang-5.0 lldb-5.0 llvm-5.0-dev libclang-5.0-dev"
121-
- host: ubuntu-latest
122-
container-options: "--rm"
123-
target: "aarch64-unknown-linux-musl"
124-
rust-build-env: 'CC_aarch64_unknown_linux_musl=clang AR_aarch64_unknown_linux_musl=llvm-ar RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld"'
125-
setup: "sudo apt-get update && sudo apt-get install -y build-essential musl-tools clang llvm gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu"
126-
- host: windows-latest
127-
target: x86_64-pc-windows-gnu
128-
setup: "rustup set default-host x86_64-pc-windows-gnu"
129-
container-options: "--rm"
130-
runs-on: ${{ matrix.settings.host }}
131-
container:
132-
image: ${{ matrix.settings.container }}
133-
options: ${{ matrix.settings.container-options }}
134-
steps:
135-
- name: Show Stage Commit
136-
run: echo "${{ needs.stage.outputs.stage-branch }}"
137-
- name: Checkout repo
138-
uses: actions/checkout@v3
139-
with:
140-
ref: "${{ needs.stage.outputs.stage-branch }}"
141-
142-
- name: Setup Container
143-
if: ${{ matrix.settings.container-setup }}
144-
run: ${{ matrix.settings.container-setup }}
145-
146-
- name: Setup Protoc
147-
uses: arduino/[email protected]
148-
with:
149-
version: "26.x"
150-
repo-token: ${{ secrets.GITHUB_TOKEN }}
151-
152-
- name: Setup capnproto
153-
uses: ./.github/actions/setup-capnproto
154-
155-
- name: Setup Rust Up
156-
if: ${{ matrix.settings.container-setup }}
157-
# setup-rust-toolchain uses the --retry-connrefused flag with curl to install rustup
158-
# this flag was added in curl 7.52.0, but the Ubuntu version we use only has 7.47.0
159-
run: |
160-
curl --proto '=https' --tlsv1.2 --retry 10 --location --silent --show-error --fail "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
161-
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
162-
163-
- name: Rust Setup
164-
uses: actions-rust-lang/setup-rust-toolchain@v1
165-
with:
166-
target: ${{ matrix.settings.target }}
167-
# needed to not make it override the defaults
168-
rustflags: ""
169-
# we want more specific settings
170-
cache: false
171-
172-
- name: Build Setup
173-
shell: bash
174-
if: ${{ matrix.settings.setup }}
175-
run: ${{ matrix.settings.setup }}
176-
177-
- name: Build
178-
run: ${{ matrix.settings.rust-build-env }} cargo build --profile release-turborepo -p turbo --target ${{ matrix.settings.target }}
179-
180-
- name: Upload Artifacts
181-
uses: actions/upload-artifact@v3
182-
with:
183-
name: turbo-${{ matrix.settings.target }}
184-
path: target/${{ matrix.settings.target }}/release-turborepo/turbo*
185-
186-
npm-publish:
187-
name: "Publish To NPM"
85+
make-release-pr:
86+
needs: [bump-version, rust-smoke-test, js-smoke-test]
87+
permissions:
88+
id-token: write # Enable OIDC
89+
pull-requests: write
90+
contents: write
18891
runs-on: ubuntu-latest
189-
needs: [stage, build-rust]
19092
steps:
191-
- name: Show Stage Commit
192-
run: echo "${{ needs.stage.outputs.stage-branch }}"
19393
- uses: actions/checkout@v3
94+
- uses: chainguard-dev/actions/setup-gitsign@main
95+
- name: Install cargo-release
96+
uses: taiki-e/install-action@v1
19497
with:
195-
ref: "${{ needs.stage.outputs.stage-branch }}"
196-
- run: git fetch origin --tags
197-
- uses: ./.github/actions/setup-node
198-
with:
199-
enable-corepack: false
200-
201-
- name: Install Global Turbo
202-
uses: ./.github/actions/install-global-turbo
203-
204-
- name: Configure git
205-
run: |
206-
git config --global user.name 'Turbobot'
207-
git config --global user.email '[email protected]'
208-
209-
- name: Install GoReleaser
210-
uses: goreleaser/goreleaser-action@v3
211-
with:
212-
distribution: goreleaser-pro
213-
version: v1.18.2
214-
install-only: true
215-
env:
216-
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
98+
tool: cargo-release
21799

218-
- name: Download Rust artifacts
219-
uses: actions/download-artifact@v3
220-
with:
221-
path: rust-artifacts
222-
223-
- name: Move Rust artifacts into place
224-
run: |
225-
mv rust-artifacts/turbo-aarch64-apple-darwin cli/dist-darwin-arm64
226-
mv rust-artifacts/turbo-aarch64-unknown-linux-musl cli/dist-linux-arm64
227-
cp -r rust-artifacts/turbo-x86_64-pc-windows-gnu cli/dist-windows-arm64
228-
mv rust-artifacts/turbo-x86_64-unknown-linux-musl cli/dist-linux-amd64
229-
mv rust-artifacts/turbo-x86_64-apple-darwin cli/dist-darwin-amd64
230-
mv rust-artifacts/turbo-x86_64-pc-windows-gnu cli/dist-windows-amd64
231-
232-
- name: Perform Release
233-
run: cd cli && make publish-turbo SKIP_PUBLISH=${{ inputs.dry_run && '--skip-publish' || '' }}
234-
env:
235-
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
236-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
237-
238-
# Upload published artifacts in case they are needed for debugging later
239-
- name: Upload Artifacts
240-
uses: actions/upload-artifact@v3
241-
with:
242-
name: turbo-combined
243-
path: cli/dist
244-
245-
create-release-pr:
246-
name: "Open Release Branch PR"
247-
needs: [stage, npm-publish]
248-
runs-on: ubuntu-latest
249-
steps:
250-
- name: Show Stage Commit
251-
run: echo "${{ needs.stage.outputs.stage-branch }}"
252-
- uses: actions/[email protected]
253-
with:
254-
ref: ${{ needs.stage.outputs.stage-branch }}
255-
- name: Get version
256-
id: getVersion
257-
run: echo "version=$(head -n 1 version.txt)" >> $GITHUB_OUTPUT
258-
- name: Create pull request
259-
uses: thomaseizinger/create-pull-request@master
260-
if: ${{ !inputs.dry_run }}
100+
- uses: cargo-bins/release-pr@v2
261101
with:
262-
github_token: ${{ secrets.GITHUB_TOKEN }}
263-
head: ${{ needs.stage.outputs.stage-branch }}
264-
base: main
265-
title: "release(turborepo): ${{ steps.getVersion.outputs.version }}"
102+
github-token: ${{ secrets.GITHUB_TOKEN }}
103+
version: ${{ needs.bump-version.outputs.version }}
104+
crate-name: turbo

Cargo.toml

+8-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,14 @@ ci = "github"
8686
# The installers to generate for each app
8787
installers = ["npm"]
8888
# Target platforms to build apps for (Rust target-triple syntax)
89-
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-musl", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
89+
targets = [
90+
"aarch64-apple-darwin",
91+
"aarch64-unknown-linux-musl",
92+
"x86_64-apple-darwin",
93+
"x86_64-unknown-linux-gnu",
94+
"x86_64-unknown-linux-musl",
95+
"x86_64-pc-windows-msvc",
96+
]
9097
# The archive format to use for windows builds (defaults .zip)
9198
windows-archive = ".tar.gz"
9299
# The archive format to use for non-windows builds (defaults .tar.xz)

0 commit comments

Comments
 (0)