add package version to github workflow
Closed this issue · 1 comments
zillionare commented
Sometimes we need to get python package version from github workflow CI.
steps:
- name: Set the value
id: step_one
run: |
echo "action_state=yellow" >> $GITHUB_ENV
- name: Use the value
id: step_two
run: |
echo "${{ env.action_state }}" # This will output 'yellow'
zillionare commented
add the following:
env.package_version_short
env.package_version_full
env.repo_name
env.repo_owner
they could be used in web hook like this:
- name: Dingtalk Robot Notify
uses: leafney/dingtalk-action@v1.0.0
env:
DINGTALK_ACCESS_TOKEN: ${{ secrets.DINGTALK_ACCESS_TOKEN }}
DINGTALK_SECRET: ${{ secrets.DINGTALK_SECRET }}
with:
msgtype: markdown
notify_when: 'success'
title: CI Notification | Success
text: |
### Build success
${{ env.package_version_full }} is built and published to test pypi
### Change History
Please check change history at https://${{ env.repo_owner }}.github.io/${{ env.repo_name }}/history
### package download
Please download the pacakge at: https://pypi.org/project/${{ env.repo_name }}/
and the result could be:
### Build success
cfg4py 0.9.3.DEV.22 is built and published to test pypi
### Change History
Please check change history at https://zillionare.github.io/cfg4py/history
### package download
Please download the pacakge at: https://test.pypi.org/project/cfg4py/