Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CD version reference #58

Merged
merged 1 commit into from
Sep 5, 2024
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
27 changes: 14 additions & 13 deletions .github/workflows/continuous_delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,43 +46,44 @@ jobs:
run: |
if [ $(git tag -l "${{ env.PACKAGE_VERSION }}") ]; then
echo "Version ${{ env.PACKAGE_VERSION }} already exists."
exit 0
echo "VERSION_CHANGED=false" >> $GITHUB_ENV
else
echo "VERSION_CHANGED=true" >> $GITHUB_ENV
fi
- name: Build and publish to pypi
if: ${{ success() && matrix.python-version == 3.8 }}
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish --build
- name: Create a Git tag
if: ${{ success() && matrix.python-version == 3.8 }}
if: ${{ env.VERSION_CHANGED == 'true' && matrix.python-version == '3.8' }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
git tag "${{ env.PACKAGE_VERSION }}"
git push origin "${{ env.PACKAGE_VERSION }}"
- name: Publish Draft Release
if: ${{ success() && matrix.python-version == 3.8 }}
if: ${{ env.VERSION_CHANGED == 'true' && matrix.python-version == '3.8' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
package-version: ${{ env.PACKAGE_VERSION }}
script: |
const { data: releases } = await github.repos.listReleases({
const { data: releases } = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
});

const draftRelease = releases.find(r => r.draft && r.name === 'Draft');

if (draftRelease) {
await github.repos.updateRelease({
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: draftRelease.id,
tag_name: package-version,
name: package-version,
tag_name: process.env.PACKAGE_VERSION,
name: process.env.PACKAGE_VERSION,
draft: false
});
} else {
core.setFailed(`Draft release named "Draft" not found.`);
};
- name: Build and publish to pypi
if: ${{ env.VERSION_CHANGED == 'true' && matrix.python-version == '3.8' }}
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish --build
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pybandits"
version = "0.5.0"
version = "0.5.1"
description = "Python Multi-Armed Bandit Library"
authors = [
"Dario d'Andrea <[email protected]>",
Expand Down
Loading