Skip to content

modify publish

modify publish #1981

Workflow file for this run

name: cicd
on:
push:
pull_request:
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
test_novus_10g:
runs-on: [snappi-ixn-ci-novus10g]
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: ${{ env.BASE_BRANCH }}
submodules: recursive
- name: Set python path
id: path
run: echo "::set-output name=pythonv::/home/github-runner/pyenv/.env/bin/python"
- name: Install dependencies
run: |
rm -rf .env
${{steps.path.outputs.pythonv}} do.py setup
${{steps.path.outputs.pythonv}} do.py init
- name: Build distribution
run: |
${{steps.path.outputs.pythonv}} do.py dist
- name: Install package on clean env
run: |
rm -rf .env
${{steps.path.outputs.pythonv}} do.py setup
${{steps.path.outputs.pythonv}} do.py install
${{steps.path.outputs.pythonv}} do.py init
- name: Run tests
run: |
TEST_USERNAME=${{secrets.TEST_USERNAME}} ${{steps.path.outputs.pythonv}} do.py test novus10g
- name: Send Coverage Email
run: |
${{steps.path.outputs.pythonv}} do.py coverage
- name: Load test report history
uses: actions/checkout@v2
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Build test report
uses: simple-elf/allure-report-action
if: always()
with:
gh_pages: gh-pages
allure_history: allure-history
allure_results: build/allure-results
- name: Publish test report
uses: peaceiris/actions-gh-pages
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-history
publish_artifacts:
runs-on: [snappi-ixn-ci-novus10g]
needs: [test_novus_10g]
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: ${{ env.BASE_BRANCH }}
submodules: recursive
- name: Set python path
id: path
run: echo "::set-output name=pythonv::/home/github-runner/pyenv/.env/bin/python"
- name: Install dependencies
run: |
rm -rf .env
${{steps.path.outputs.pythonv}} do.py setup
${{steps.path.outputs.pythonv}} do.py init
- name: Build distribution
run: |
${{steps.path.outputs.pythonv}} do.py dist
- name: Get package version
id: get_version
run: |
echo "::set-output name=version::v$(${{steps.path.outputs.pythonv}} do.py version)"
- name: Check tag for current version
uses: mukunku/[email protected]
id: check_tag
with:
tag: ${{ steps.get_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package
id: release
if: github.ref == 'refs/heads/main' && steps.check_tag.outputs.exists == 'false'
run: |
export RELEASE_FLAG=1
echo "::set-output name=release_flag::${RELEASE_FLAG}"
PYPI_USERNAME=__token__ PYPI_PASSWORD=${{ secrets.PYPI_API_TOKEN }} ${{steps.path.outputs.pythonv}} do.py release
- name: Create release and publish artifacts
if: github.ref == 'refs/heads/main' && steps.check_tag.outputs.exists == 'false'
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
tag: ${{ steps.get_version.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts if release didn't happen
if: steps.check_tag.outputs.exists == 'true'
uses: actions/upload-artifact@v3
with:
path: dist