Skip to content

Commit

Permalink
ci: PLT-583: Add custom check for sdk version in release
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitabelonogov committed Dec 5, 2024
1 parent fd78752 commit df34d55
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions .github/workflows/build_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,36 @@ jobs:
VERSION_OVERRIDE: ${{ inputs.version }}
run: poetry build

- name: Attach artifacts to release
if: inputs.release-id
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GIT_PAT }}
script: |
const { repo, owner } = context.repo;
const fs = require('fs');
const release_id = '${{ inputs.release-id }}';
for (let file of await fs.readdirSync('./dist/')) {
console.log('uploadReleaseAsset', file);
await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: release_id,
name: file,
data: await fs.readFileSync(`./dist/${file}`)
});
}
- name: Check SDK version is not git sha
run: grep 'label-studio-sdk\s*=\s*"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"' pyproject.toml

- name: Upload to PYPI
if: inputs.upload_to_pypi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_APIKEY }}
run: poetry run twine upload ${{ inputs.upload_to_pypi == false && '--dry-run' || '' }} dist/*
TWINE_PASSWORD: ${{ inputs.upload_to_pypi && secrets.PYPI_APIKEY || secrets.PYPI_APIKEY_TEST }}
TWINE_REPOSITORY_URL: ${{ inputs.upload_to_pypi && 'https://upload.pypi.org/legacy/ ' || 'https://test.pypi.org/legacy/' }}
run: poetry run twine upload dist/*

- name: Get PyPI package details
id: pypi-package-details
Expand Down Expand Up @@ -173,26 +198,6 @@ jobs:
}
}, 60 * 1000 )
- name: Attach artifacts to release
if: inputs.release-id
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GIT_PAT }}
script: |
const { repo, owner } = context.repo;
const fs = require('fs');
const release_id = '${{ inputs.release-id }}';
for (let file of await fs.readdirSync('./dist/')) {
console.log('uploadReleaseAsset', file);
await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: release_id,
name: file,
data: await fs.readFileSync(`./dist/${file}`)
});
}
- name: Check file size
env:
DIST_DIR: "./dist"
Expand Down

0 comments on commit df34d55

Please sign in to comment.