Skip to content

Commit b56a3e3

Browse files
Merge pull request #106 from amd/development
dev -> main
2 parents 586677b + 8405d51 commit b56a3e3

5 files changed

Lines changed: 126 additions & 4 deletions

File tree

.github/workflows/code_quality_checks.yml

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

1111
jobs:
1212
pre-commit:
13-
runs-on: [ self-hosted ]
13+
runs-on: ubuntu-latest
1414
container: python:3.9
1515

1616
steps:

.github/workflows/functional-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111

1212
jobs:
1313
run_tests:
14-
runs-on: [ self-hosted ]
14+
runs-on: ubuntu-latest
1515
container: python:3.9
1616

1717
steps:
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Release (Trusted Publisher)
2+
3+
permissions:
4+
contents: write # Required for creating releases and pushing tags
5+
id-token: write # Required for PyPI Trusted Publishing
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
release_type:
11+
description: 'Release type (major, minor, patch)'
12+
required: true
13+
type: choice
14+
options:
15+
- patch
16+
- minor
17+
- major
18+
19+
jobs:
20+
release:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 0 # Fetch all history and tags
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Fetch all tags
31+
run: |
32+
git fetch --tags --force
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v4
36+
with:
37+
python-version: '3.9'
38+
39+
- name: Configure Git
40+
run: |
41+
git config --global user.name "github-actions[bot]"
42+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
43+
44+
- name: Calculate next version
45+
id: next_version
46+
shell: bash
47+
run: |
48+
# Get the latest tag, default to v0.0.0 if no tags exist
49+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
50+
echo "Latest tag: $LATEST_TAG"
51+
52+
# Remove 'v' prefix and split into components
53+
VERSION=${LATEST_TAG#v}
54+
IFS='.' read -r -a VERSION_PARTS <<< "$VERSION"
55+
MAJOR="${VERSION_PARTS[0]:-0}"
56+
MINOR="${VERSION_PARTS[1]:-0}"
57+
PATCH="${VERSION_PARTS[2]:-0}"
58+
59+
echo "Current version: $MAJOR.$MINOR.$PATCH"
60+
61+
# Increment based on release type
62+
case "${{ github.event.inputs.release_type }}" in
63+
major)
64+
MAJOR=$((MAJOR + 1))
65+
MINOR=0
66+
PATCH=0
67+
;;
68+
minor)
69+
MINOR=$((MINOR + 1))
70+
PATCH=0
71+
;;
72+
patch)
73+
PATCH=$((PATCH + 1))
74+
;;
75+
esac
76+
77+
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
78+
echo "New version: $NEW_VERSION"
79+
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
80+
81+
- name: Create and push tag
82+
run: |
83+
git tag ${{ steps.next_version.outputs.version }}
84+
git push origin ${{ steps.next_version.outputs.version }}
85+
86+
- name: Install build dependencies
87+
run: |
88+
python -m pip install --upgrade pip
89+
python -m pip install build
90+
91+
- name: Build package
92+
run: |
93+
python -m build
94+
95+
- name: Upload to PyPI using Trusted Publisher
96+
uses: pypa/gh-action-pypi-publish@release/v1
97+
with:
98+
packages-dir: dist/
99+
100+
- name: Create GitHub Release
101+
env:
102+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
run: |
104+
gh release create ${{ steps.next_version.outputs.version }} \
105+
--title "${{ steps.next_version.outputs.version }}" \
106+
--generate-notes \
107+
dist/*
108+
109+
- name: Print summary
110+
if: success()
111+
run: |
112+
echo "### :rocket: Release ${{ steps.next_version.outputs.version }} completed successfully!" >> $GITHUB_STEP_SUMMARY
113+
echo "" >> $GITHUB_STEP_SUMMARY
114+
echo "- **Release Type:** ${{ github.event.inputs.release_type }}" >> $GITHUB_STEP_SUMMARY
115+
echo "- **New Version:** ${{ steps.next_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
116+
echo "- **PyPI Package:** Published via Trusted Publisher" >> $GITHUB_STEP_SUMMARY
117+
echo "- **GitHub Release:** Created with auto-generated notes" >> $GITHUB_STEP_SUMMARY
118+
119+
- name: Print failure message
120+
if: failure()
121+
run: |
122+
echo "### :x: Release failed. Please check the logs above." >> $GITHUB_STEP_SUMMARY

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111

1212
jobs:
1313
run_tests:
14-
runs-on: [ self-hosted ]
14+
runs-on: ubuntu-latest
1515
container: python:3.9
1616

1717
steps:

.github/workflows/update-plugin-docs.yml

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

1414
jobs:
1515
generate_docs:
16-
runs-on: [ self-hosted ]
16+
runs-on: ubuntu-latest
1717
# To disable this workflow, set DISABLE_AUTO_DOCS to 'true' in repository variables
1818
if: vars.DISABLE_AUTO_DOCS != 'true'
1919
env:

0 commit comments

Comments
 (0)