Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Auto-Release
on:
push:
branches:
- develop
workflow_dispatch:

permissions:
contents: read

jobs:
semantic-version:
if: false # TODO(CG-10755): merge this with release.yml
name: Semantic version
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.semantic.outputs.release-version }}
permissions:
checks: read # to wait for required checks
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# TODO(CG-10743): clean-up once we remove LFS
- name: Remove pre-push hook
run: rm -f .git/hooks/pre-push

- name: Wait for required checks
uses: poseidon/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
match_pattern: "(unit-tests|integration-tests)"

- uses: codfish/semantic-release-action@v3
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
needs: semantic-version
uses: ./.github/workflows/release.yml
with:
tag: ${{ needs.semantic-version.outputs.tag }}
81 changes: 19 additions & 62 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
name: Build & Release

on:
workflow_call:
inputs:
tag:
required: true
type: string
description: Tag to release
# TODO(CG-10758): create if it does not exist
# workflow_dispatch:
# inputs:
# tag:
# required: true
# type: string
# description: Tag to release # TODO: create if it does not exist
push:
tags:
- v*
branches:
- develop
pull_request:
branches:
- develop
workflow_dispatch:

permissions:
contents: read
Expand Down Expand Up @@ -41,7 +51,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref || github.ref }}
ref: ${{ inputs.tag || github.event.pull_request.head.ref || github.ref }}

- name: Install UV
uses: astral-sh/[email protected]
Expand Down Expand Up @@ -69,71 +79,17 @@ jobs:
name: wheels-${{ matrix.os }}-3.${{ matrix.python }}
path: ./wheelhouse/*.whl

auto-release:
if: github.ref_name == 'develop'
environment: release
release:
if: ${{ inputs.tag || startsWith(github.ref, 'refs/tags/') }}
needs: build
runs-on: ubuntu-latest
permissions:
checks: read # to wait for required checks
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# TODO(CG-10743): clean-up once we remove LFS
- name: Remove pre-push hook
run: rm -f .git/hooks/pre-push

- name: Setup environment
uses: ./.github/actions/setup-environment

- name: Wait for required checks
uses: poseidon/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
match_pattern: "(unit-tests|integration-tests)"

- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
pattern: wheels-*

- name: Github semantic release
uses: codfish/semantic-release-action@v3
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Release PyPI
if: ${{ steps.semantic.outputs.new-release-published == 'true' }}
uses: ./.github/actions/release-pypi
with:
pypi-token: ${{ secrets.PYPI_TOKEN }}

- name: Slack notification
if: ${{ steps.semantic.outputs.new-release-published == 'true' }}
uses: ./.github/actions/release-slack-bot
with:
release-tag: ${{ steps.semantic.outputs.release-version }}
slack-token: ${{ secrets.SLACK_BOT_TOKEN }}

manual-release:
if: startsWith(github.ref, 'refs/tags/')
environment: release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write # grants permission to create a release on github
steps:
- uses: actions/checkout@v4

- name: Setup environment
- name: Setup backend
uses: ./.github/actions/setup-environment

- name: Download All Artifacts
Expand All @@ -152,9 +108,10 @@ jobs:
id: github-release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag || github.ref_name }}
files: dist/*
fail_on_unmatched_files: true
generate_release_notes: true
generate_release_notes: ${{ startsWith(github.ref, 'refs/tags/') }}

- name: Slack notification
if: always()
Expand Down
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"assets": ["dist/**"]
}
]
"@semantic-release/github"
]
}
}