Release and publish a new version #61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Start a new release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Tag to be created, in the form X.Y.Z' | |
required: true | |
type: string | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if organization member | |
id: is_organization_member | |
uses: JamesSingleton/[email protected] | |
with: | |
organization: Giskard-AI | |
username: ${{ github.actor }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Interrupt job | |
if: ${{ steps.is_organization_member.outputs.result == 'false' }} | |
shell: bash | |
run: | | |
echo "Job failed due to user not being a member of Giskard-AI organization and the 'safe for build' label not being set on the PR" | |
exit 1 | |
- name: Checkout code | |
uses: actions/[email protected] | |
with: | |
fetch-tags: true | |
ref: main | |
token: ${{ secrets.RELEASE_PAT_TOKEN }} # Needed to trigger other actions | |
- name: Edit pyproject.toml | |
run: sed -i 's/^\(version *= *\).*$/\1"${{ inputs.version }}"/' pyproject.toml | |
- name: Remove dark theme logo from README | |
run: sed -i 's/.*#gh-dark-mode-only.*//' README.md | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: '3.10' | |
cache: false | |
- name: Build release candidate wheel | |
run: pdm build | |
- name: Upload RC wheel artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rc-wheel-${{ inputs.version }} | |
path: dist/*whl | |
if-no-files-found: error | |
retention-days: 1 | |
- name: "@slack Release process started" | |
id: slack | |
uses: slackapi/[email protected] | |
with: | |
channel-id: ${{ vars.SLACK_CHANNEL_ID }} | |
slack-message: |- | |
Release *v${{ inputs.version }}* is on the way :rocket: | |
<${{ github.server_url }}/${{ github.actor }}|@${{ github.actor }}> | <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|commit> <!channel> | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
- name: Trigger release process in giskard-hub | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.RELEASE_PAT_TOKEN }} | |
event-type: create-release | |
repository: ${{ github.repository_owner }}/giskard-hub | |
client-payload: | | |
{ | |
"version_name": "v${{ inputs.version }}", | |
"slack_thread_id": "${{ steps.slack.outputs.thread_ts }}" | |
} |