Skip to content

Commit

Permalink
update: update release
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-Shen committed Feb 4, 2024
1 parent f1dcc08 commit 0ad5740
Showing 1 changed file with 69 additions and 73 deletions.
142 changes: 69 additions & 73 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Show current branch
run: |
echo ${{ github.ref_name }}
- name: Set test pip url
if: ${{ github.ref_name == 'alpha' }}
run: |
Expand All @@ -62,75 +58,75 @@ jobs:
run: |
echo $PYPI_URL
# - name: Inject backend info into frontend
# uses: satackey/[email protected]
# id: InjectBackend
# with:
# required-packages: '@iarna/toml'
# script: |
# const fs = require('fs');
# const path = require('path');
# const toml = require('@iarna/toml');
# const rootPath = path.join(process.cwd(), '');

# console.log('rootPath', rootPath);

# try {
# const projectInfo = toml.parse(
# fs.readFileSync(path.join(rootPath, 'pyproject.toml'), 'utf8')
# );
# const backendInfo = {
# version: process.env.NEXT_VERSION,
# name: projectInfo.tool.poetry.name || 'LabelU',
# build_time: new Date().toISOString(),
# commit: process.env.GITHUB_SHA,
# };

# const code = `
# (function () {
# window.__backend = ${JSON.stringify(backendInfo, null, 2)};
# })();
# `;

# fs.writeFileSync(
# path.join(rootPath, 'labelu/internal/statics/backend_version.js'),
# code,
# 'utf-8'
# );

# console.log('Update backend_version.js success!');
# } catch (e) {
# console.error(e);
# process.exit(1);
# }

# - uses: abatilo/actions-poetry@v2
# with:
# poetry-version: ${{ matrix.poetry-version }}

# - name: Install dependencies
# run: poetry install --without dev

# - name: Run tests
# run: poetry run pytest --cov=./ --cov-report=xml

# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
# files: ./coverage.xml
# verbose: true

# - name: Manage version
# run: |
# sed -i "s/^version[ ]*=.*/version = '${NEXT_VERSION}'/" pyproject.toml

# - name: Publish
# env:
# PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
# run: |
# poetry config pypi-token.pypi $PYPI_TOKEN
# poetry publish --build --skip-existing
- name: Inject backend info into frontend
uses: satackey/[email protected]
id: InjectBackend
with:
required-packages: '@iarna/toml'
script: |
const fs = require('fs');
const path = require('path');
const toml = require('@iarna/toml');
const rootPath = path.join(process.cwd(), '');
console.log('rootPath', rootPath);
try {
const projectInfo = toml.parse(
fs.readFileSync(path.join(rootPath, 'pyproject.toml'), 'utf8')
);
const backendInfo = {
version: process.env.NEXT_VERSION,
name: projectInfo.tool.poetry.name || 'LabelU',
build_time: new Date().toISOString(),
commit: process.env.GITHUB_SHA,
};
const code = `
(function () {
window.__backend = ${JSON.stringify(backendInfo, null, 2)};
})();
`;
fs.writeFileSync(
path.join(rootPath, 'labelu/internal/statics/backend_version.js'),
code,
'utf-8'
);
console.log('Update backend_version.js success!');
} catch (e) {
console.error(e);
process.exit(1);
}
- uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}

- name: Install dependencies
run: poetry install --without dev

- name: Run tests
run: poetry run pytest --cov=./ --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./coverage.xml
verbose: true

- name: Manage version
run: |
sed -i "s/^version[ ]*=.*/version = '${NEXT_VERSION}'/" pyproject.toml
- name: Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build --skip-existing
# ====================== post release ======================

Expand Down

0 comments on commit 0ad5740

Please sign in to comment.