Skip to content
Open
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
44 changes: 8 additions & 36 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,11 @@ on:
tags:
- v1r0p[0-9]+
pull_request:
# workflow_dispatch:
# inputs:
# tag:
# description: 'Old style tag name, e.g.: v4r3p5'
# required: true
# deploy_github:
# description: 'Create PEP-440 styled tag release in GitHub'
# required: false
# default: false
# deploy_pypi:
# description: 'Create PEP-440 styled tag release in PyPI'
# required: false
# default: false

jobs:
deploy-pypi:
name: PyPI deployment
runs-on: "ubuntu-latest"
outputs:
tag_name: ${{ steps.PEP-440.outputs.tag_name }}
target_commitish: ${{ steps.PEP-440.outputs.target_commitish }}

if: github.event_name != 'push' || github.repository == 'TaykYoku/WebAppDIRAC'
steps:
Expand All @@ -43,42 +27,30 @@ jobs:
id: PEP-440
# if: github.event_name == 'push'
run: |
# TAG_NAME=${GITHUB_REF##*/}
echo "git ref: ${GITHUB_REF##*/}"
TAG_NAME=v1r0p4
NEW_STYLE=$(python -c "import diraccfg; major, minor, patch, pre = diraccfg.parseVersion('${TAG_NAME}'); print(f'{major}.{minor}.{patch}', f'a{pre}' if pre else '', sep='')")
echo "Converted ${TAG_NAME} version to ${NEW_STYLE}"
cat release.notes
echo ::set-output name=tag_name::"v$NEW_STYLE"
echo ::set-output name=target_commitish::"$(git rev-parse HEAD)"

create-pep440-release:
name: PEP-440 release deployment
runs-on: "ubuntu-latest"
needs: deploy-pypi
steps:
- run: cat release.notes
- run: git tag
- name: Publish ${{needs.deploy-pypi.outputs.tag_name}} release to GitHub
# if: github.event_name == 'push' || ${{ inputs.deploy_github }}
- run: echo ${{ steps.PEP-440.outputs.tag_name }}
- run: echo ${{ steps.PEP-440.outputs.target_commitish }}
- name: Publish ${{ steps.PEP-440.outputs.tag_name }} release to GitHub
# if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
target_commitish: ${{ needs.deploy-pypi.outputs.target_commitish }}
target_commitish: ${{ steps.PEP-440.outputs.target_commitish }}
body_path: release.notes
tag_name: ${{needs.deploy-pypi.outputs.tag_name}}
tag_name: ${{ steps.PEP-440.outputs.tag_name }}

create-pypi-release:
name: PyPI release deployment
runs-on: "ubuntu-latest"
needs: [deploy-pypi, create-pep440-release]
steps:
- name: Get ${{ steps.PEP-440.outputs.tag_name }} tag
uses: actions/checkout@v2
with:
ref: ${{ steps.PEP-440.outputs.tag_name }}
- name: Build distributions
run: python -m build
- name: Publish package on PyPI
# if: github.event_name == 'push' || ${{ inputs.deploy_pypi }}
# if: github.event_name == 'push'
run: ls dist/
# uses: pypa/gh-action-pypi-publish@master
# with:
Expand Down