Skip to content

Commit

Permalink
Delete the prerelease before creating the new one (#1485)
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/python.yml
  • Loading branch information
jleibs authored and Wumpf committed Mar 7, 2023
1 parent d7b6530 commit 47951dd
Showing 1 changed file with 39 additions and 47 deletions.
86 changes: 39 additions & 47 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,18 @@ name: CI (Python)

on:
pull_request:
types: [labeled, synchronize, opened]
push:
branches:
- "main"
tags:
- "v*.*.*" # on release tag
workflow_dispatch:
inputs:
force_build_wheel:
description: "Build python wheels"
required: true
default: false
type: boolean

env:
PYTHON_VERSION: "3.8"
PRE_RELEASE_INSTRUCTIONS: |
## Installing the pre-release Python SDK
1. Download the correct `.whl`.
1. Download the correct `.whl`. For Mac M1/M2, grab the "universal2" `.whl`
2. Run `pip install rerun_sdk<...>.whl` (replace `<...>` with the actual filename)
3. Test it: `rerun --version`
UBUNTU_REQUIRED_PKGS: libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libfontconfig1-dev libatk-bridge2.0 libfreetype6-dev libglib2.0-dev
Expand Down Expand Up @@ -65,8 +59,8 @@ jobs:

matrix-setup:
# Building all the wheels is expensive, so we only run this job when we push (to main or release tags),
# or if the job was manually triggered with `force_build_wheel` set to true.
if: github.event_name == 'push' || github.event.inputs.force_build_wheel
# or if the PR has the 'build wheels' label for explicit testing of wheels.
if: github.event_name == 'push' || contains( github.event.pull_request.labels.*.name, '🛞 build wheels')
runs-on: ubuntu-latest

outputs:
Expand All @@ -81,15 +75,22 @@ jobs:
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
# Sets TAGGED_OR_MAIN if this workflow is running on a tag or the main branch.
- name: Set TAGGED_OR_MAIN
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
run: echo "TAGGED_OR_MAIN=1" >> $GITHUB_ENV

- id: set-matrix
shell: bash
run: |
matrix=()
matrix+=('{"platform": "macos", "target": "x86_64-apple-darwin", "runs_on": "macos-latest"},')
matrix+=('{"platform": "macos", "target": "aarch64-apple-darwin", "runs_on": "macos-latest"},')
matrix+=('{"platform": "windows", "target": "x86_64-pc-windows-msvc", "runs_on": "windows-latest-8-cores"},')
matrix+=('{"platform": "linux", "target": "x86_64-unknown-linux-gnu", "runs_on": "ubuntu-latest-16-cores", container: {"image": "rerunio/ci_docker:0.5"}}')
if [[ $TAGGED_OR_MAIN ]]; then
# MacOS build is really slow (>30 mins); uses up a lot of CI minutes
matrix+=('{"platform": "macos", "runs_on": "macos-latest"},')
fi
matrix+=('{"platform": "windows", "runs_on": "windows-latest-8-cores"},')
matrix+=('{"platform": "linux", "runs_on": "ubuntu-latest-16-cores", container: {"image": "rerunio/ci_docker:0.5"}}')
echo "Matrix values: ${matrix[@]}"
Expand Down Expand Up @@ -185,7 +186,7 @@ jobs:
# This updates the cargo.lock file with the new version numbers and keeps the wheel build from failing
run: |
python3 scripts/version_util.py --patch_prerelease
cargo update -w
cargo check
- name: Version check for tagged-release
if: startsWith(github.ref, 'refs/tags/v')
Expand All @@ -203,9 +204,9 @@ jobs:
args: |
--manifest-path rerun_py/Cargo.toml
--release
--target ${{ matrix.target }}
--no-default-features
--features pypi
--universal2
--out pre-dist
- name: Install built wheel
Expand Down Expand Up @@ -279,21 +280,27 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Re-tag the prerelease with the commit from this build
# https://github.com/richardsimko/update-tag
- name: Update prerelease tag
uses: richardsimko/update-tag@v1
with:
tag_name: prerelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Create the actual prerelease
# https://github.com/ncipollo/release-action
# https://github.com/softprops/action-gh-release
- name: GitHub Release
uses: ncipollo/release-action@v1.12.0
uses: softprops/action[email protected]
with:
name: "Development Build"
body: ${{ env.PRE_RELEASE_INSTRUCTIONS }}
prerelease: true
artifacts: dist/*
name: "Development Build"
tag: "prerelease"
tag_name: prerelease
files: dist/*
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: true
generate_release_notes: true

# ---------------------------------------------------------------------------

Expand All @@ -310,14 +317,13 @@ jobs:
name: wheels
path: dist

# https://github.com/ncipollo/release-action
- name: GitHub Release
uses: ncipollo/release-action@v1.12.0
uses: softprops/action[email protected]
with:
prerelease: true
artifacts: dist/*
prerelease: false
files: dist/*
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
generate_release_notes: true

- name: Publish to PyPI
uses: PyO3/maturin-action@v1
Expand Down Expand Up @@ -382,28 +388,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Mike will incrementally update the existing gh-pages branch
# We then check it out, and reset it to a new orphaned branch, which we force-push to origin
# to make sure we don't accumulate unnecessary history in gh-pages branch
- name: Deploy via mike # https://github.com/jimporter/mike
if: startsWith(github.ref, 'refs/tags/v')
run: |
git fetch
mike deploy -F rerun_py/mkdocs.yml --rebase -b gh-pages --prefix docs/python -u ${{github.ref_name}} latest
git checkout gh-pages
git checkout --orphan gh-pages-orphan
git commit -m "Update docs for ${GITHUB_SHA}"
git push origin gh-pages-orphan:gh-pages -f
# Mike will incrementally update the existing gh-pages branch
# We then check it out, and reset it to a new orphaned branch, which we force-push to origin
# to make sure we don't accumulate unnecessary history in gh-pages branch
mike deploy -F rerun_py/mkdocs.yml -p --rebase -b gh-pages --prefix docs/python -u ${{github.ref_name}} latest
- name: Deploy tag via mike # https://github.com/jimporter/mike
if: github.ref == 'refs/heads/main'
run: |
git fetch
mike deploy -F rerun_py/mkdocs.yml --rebase -b gh-pages --prefix docs/python HEAD
git checkout gh-pages
git checkout --orphan gh-pages-orphan
git commit -m "Update docs for ${GITHUB_SHA}"
git push origin gh-pages-orphan:gh-pages -f
mike deploy -F rerun_py/mkdocs.yml -p --rebase -b gh-pages --prefix docs/python HEAD

0 comments on commit 47951dd

Please sign in to comment.