Skip to content

Commit 684f98c

Browse files
committed
Build a fully automated release pipeline
1 parent 6b58cf7 commit 684f98c

5 files changed

Lines changed: 141 additions & 1 deletion

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Tag release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Tag to be created, in the form vX.Y.Z'
8+
required: true
9+
type: string
10+
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check if organization member
17+
id: is_organization_member
18+
uses: JamesSingleton/is-organization-member@1.0.1
19+
with:
20+
organization: Giskard-AI
21+
username: ${{ github.actor }}
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Interrupt job
25+
if: ${{ steps.is_organization_member.outputs.result == 'false' }}
26+
shell: bash
27+
run: |
28+
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"
29+
exit 1
30+
31+
- name: Checkout code
32+
uses: actions/checkout@v4.1.0
33+
with:
34+
fetch-tags: true
35+
ref: main
36+
token: ${{ secrets.RELEASE_PAT_TOKEN }} # Needed to trigger other actions
37+
38+
- name: Edit pyproject.toml
39+
run: sed -i "s/\^(version *= *\).*$/\1${{ inputs.version }}/" pyproject.toml
40+
41+
- name: Configure git
42+
run: |
43+
git config --global user.name 'BotReleaser'
44+
git config --global user.email 'bot.releaser@users.noreply.github.com'
45+
46+
- name: Adding file
47+
run: |
48+
git add pyproject.toml
49+
git commit -m "${{ inputs.version }}"
50+
git tag ${{ inputs.version }}
51+
52+
- name: Push to main and tags
53+
run: |
54+
git push origin main
55+
git push origin ${{ inputs.version }}

.github/workflows/do-release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Tag release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4.1.0
16+
- name: Setup PDM
17+
uses: pdm-project/setup-pdm@v3
18+
with:
19+
python-version: 3.10
20+
cache: false
21+
- name: Build dist
22+
run: pdm build
23+
24+
- name: Release
25+
id: github-release
26+
uses: softprops/action-gh-release@v1
27+
with:
28+
fail_on_unmatched_files: true
29+
generate_release_notes: true
30+
files: |
31+
dist/giskard-*.tar.gz
32+
dist/giskard-*.whl
33+
34+
- name: Repository Dispatch
35+
uses: peter-evans/repository-dispatch@v2
36+
with:
37+
token: ${{ secrets.RELEASE_PAT_TOKEN }}
38+
event-type: trigger-release
39+
repository: giskard-ai/giskard-hub
40+
client-payload: |
41+
{
42+
"wheel_url": "${{ steps.github-release.outputs.assets[1].browser_download_url }}",
43+
"version": "${{ github.ref_name }}",
44+
"ref": "${{ github.ref }}",
45+
}

.github/workflows/nightly-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
call-full-ci:
9-
uses: ./.github/workflows/build_backend.yml
9+
uses: ./.github/workflows/build-python.yml
1010
with:
1111
run-integration-tests: true
1212
use-cache: false

.github/workflows/post-release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Tag release
2+
3+
on:
4+
repository_dispatch:
5+
types:
6+
- post-release
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check if organization member
15+
id: is_organization_member
16+
uses: JamesSingleton/is-organization-member@1.0.1
17+
with:
18+
organization: Giskard-AI
19+
username: ${{ github.actor }}
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
- name: Interrupt job
22+
if: ${{ steps.is_organization_member.outputs.result == 'false' }}
23+
shell: bash
24+
run: |
25+
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"
26+
exit 1
27+
- name: Checkout code
28+
uses: actions/checkout@v4.1.0
29+
with:
30+
fetch-tags: true
31+
ref: ${{ github.event.client_payload.version }}
32+
33+
- name: Setup PDM
34+
uses: pdm-project/setup-pdm@v3
35+
with:
36+
python-version: 3.10
37+
cache: false
38+
39+
- name: Push to Pipy
40+
run: pdm publish --username ${{ secrets.PIPY_USERNAME }} --password ${{ secrets.PIPY_PASSWORD }}

0 commit comments

Comments
 (0)