Skip to content

Commit

Permalink
Merge pull request #11 from 201st-Luka/creating_package
Browse files Browse the repository at this point in the history
corrected prerelease.yml error
  • Loading branch information
201st-Luka authored Jul 19, 2023
2 parents 8ad5a0a + 4a9184e commit 8b9bad6
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
python-version: 3.11

- name: Install dependencies
run: |
Expand All @@ -27,36 +27,40 @@ jobs:
pip install wheel
- name: Get package version
id: version
id: get_version
run: |
echo "::set-output name=version::$(python -c "import setup; print(setup.VERSION)")"
import re
with open('setup.py') as setup_py:
content = setup_py.read()
version = re.search(r"VERSION = '([^']+)'", content).group(1)
echo "::set-output name=version::$version"
- name: Build package
run: python setup.py sdist bdist_wheel

- name: Create Release
- name: Create Pre-release
uses: actions/github-script@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
const { Octokit } = require("@octokit/rest");
const octokit = new Octokit();
const version = "${{ steps.version.outputs.version }}";
octokit.repos.createRelease({
const github = context.github;
const version = "${{ steps.get_version.outputs.version }}";
const response = await github.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `${version}`,
tag_name: `v${version}`,
name: `Pre-release ${version}`,
body: "This is the release body",
body: "Changelog",
draft: true,
prerelease: true
});
console.log(response.data.html_url);
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: package
path: |
./dist/*.whl
./dist/*.tar.gz
./dist/*.tar.gz

0 comments on commit 8b9bad6

Please sign in to comment.