v5.1.0 #62
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Update changelog | |
# 2. Upload a Python Package using Twine | |
name: Release fosslight_binary | |
on: | |
release: | |
types: [published] | |
jobs: | |
update-changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get Release | |
uses: bruceadams/get-release@v1.3.2 | |
id: get_release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Bump up version | |
env: | |
NEW_TAG: ${{ steps.get_release.outputs.tag_name }} | |
run: | | |
pip install --upgrade bumpversion | |
LAST_TWO_TAGS=$(git for-each-ref refs/tags/ --count=2 --sort=-v:refname --format="%(refname:short)") | |
LAST_ONE=$(echo $LAST_TWO_TAGS | cut -d' ' -f 2) | |
last_version=$(echo ${LAST_ONE//v/""}) | |
echo Last version: ${last_version} | |
new_version=$(echo ${NEW_TAG//v/""}) | |
echo New version: ${new_version} | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "fosslight-dev@lge.com" | |
bumpversion --current-version $last_version --new-version $new_version setup.py | |
- name: update changelog with gren | |
env: | |
GREN_GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
run: | | |
npm install github-release-notes@0.17.3 | |
node_modules/.bin/gren changelog --override | |
- name: Commit files | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "fosslight-dev@lge.com" | |
git add CHANGELOG.md | |
git commit -m "Update ChangeLog" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.TOKEN }} | |
branch: main | |
build: | |
name: Build packages | |
needs: update-changelog | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
TARGET: ubuntu | |
CMD_BUILD: > | |
pyinstaller --onefile cli.py -n cli --additional-hooks-dir=hooks --hidden-import=pkg_resources.extern --add-binary "LICENSE:LICENSES" --add-binary "LICENSES/LicenseRef-3rd_party_licenses.txt:LICENSES" && | |
mv dist/cli fosslight_bin_ubuntu18 | |
OUT_FILE_NAME: fosslight_bin_ubuntu18 | |
ASSET_MIME: application/octet-stream | |
- os: macos-latest | |
TARGET: macos | |
CMD_BUILD: > | |
pyinstaller --onefile cli.py -n cli --additional-hooks-dir=hooks --hidden-import=pkg_resources.extern --add-binary "LICENSE:LICENSES" --add-binary "LICENSES/LicenseRef-3rd_party_licenses.txt:LICENSES" && | |
mv dist/cli fosslight_bin_macos | |
OUT_FILE_NAME: fosslight_bin_macos | |
ASSET_MIME: aapplication/x-mach-binary | |
- os: windows-latest | |
TARGET: windows | |
CMD_BUILD: > | |
pyinstaller --onefile cli.py -n cli --additional-hooks-dir=hooks --hidden-import=pkg_resources.extern --add-binary "LICENSE;LICENSES" --add-binary "LICENSES\LicenseRef-3rd_party_licenses.txt;LICENSES" && | |
move dist/cli.exe fosslight_bin_windows.exe | |
OUT_FILE_NAME: fosslight_bin_windows.exe | |
ASSET_MIME: application/vnd.microsoft.portable-executable | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
pip install pyinstaller==5.9.0 | |
- name: Build with pyinstaller for ${{matrix.TARGET}} | |
run: ${{matrix.CMD_BUILD}} | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./${{ matrix.OUT_FILE_NAME}} | |
asset_name: ${{ matrix.OUT_FILE_NAME}} | |
asset_content_type: ${{ matrix.ASSET_MIME}} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python setup.py sdist bdist_wheel | |
twine upload dist/* |