Skip to content

Make Release

Make Release #174

Workflow file for this run

name: Make Release
on: workflow_dispatch
jobs:
release_create:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
new_sha: ${{ steps.commit_updated.outputs.sha }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip3 install poetry
- name: Bump version
run: >-
poetry version patch
- name: Get version
id: get_version
run: >-
poetry version --short | sed 's/^/::set-output name=version::/'
- name: Commit updated version.
id: commit_updated
run: |
git config --global user.name 'github-actions'
git config --global user.email 'bot@noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git add pyproject.toml
git commit -m "bump version to ${{ steps.get_version.outputs.version }}" && git push || echo "No changes to commit"
git log -n 1 --pretty=format:"%H" | tail -n 1 | awk '{print "::set-output name=sha::"$0}'
- name: Create GitHub release
uses: actions/create-release@v1
id: create_release
with:
draft: true
prerelease: true
release_name: Meshtastic Python ${{ steps.get_version.outputs.version }}
tag_name: ${{ steps.get_version.outputs.version }}
commitish: ${{ steps.commit_updated.outputs.sha }}
body: |
Autogenerated by github action, developer should edit as required before publishing...
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build a binary wheel and a source tarball
run: >-
poetry build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# build-and-publish-mac:
# runs-on: macos-latest
# needs: release_create
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# ref: ${{ needs.release_create.outputs.new_sha }}
# - name: Set up Python 3.9
# uses: actions/setup-python@v5
# with:
# python-version: "3.9"
# - name: Setup code signing
# env:
# MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
# MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
# MACOS_KEYCHAIN_PASSWORD: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }}
# run: |
# echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
# security create-keychain -p "$MACOS_KEYCHAIN_PASSWORD" meshtastic.keychain
# security default-keychain -s meshtastic.keychain
# security unlock-keychain -p "$MACOS_KEYCHAIN_PASSWORD" meshtastic.keychain
# security import certificate.p12 -k meshtastic.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
# security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_KEYCHAIN_PASSWORD" meshtastic.keychain
# - name: Build
# env:
# MACOS_SIGNING_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY }}
# run: |
# pip install pyinstaller
# pip install -r requirements.txt
# pip install .
# pyinstaller -F -n meshtastic --collect-all meshtastic --codesign-identity "$MACOS_SIGNING_IDENTITY" meshtastic/__main__.py
# - name: Add mac to release
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.release_create.outputs.upload_url }}
# asset_path: dist/meshtastic
# asset_name: meshtastic_mac
# asset_content_type: application/zip
build-and-publish-ubuntu:
runs-on: ubuntu-latest
needs: release_create
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.release_create.outputs.new_sha }}
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Build
run: |
pip install poetry
bin/build-bin.sh
- name: Add ubuntu to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release_create.outputs.upload_url }}
asset_path: dist/meshtastic
asset_name: meshtastic_ubuntu
asset_content_type: application/zip
- name: Add readme.txt to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release_create.outputs.upload_url }}
asset_path: standalone_readme.txt
asset_name: readme.txt
asset_content_type: text/plain
# build-and-publish-windows:
# runs-on: windows-latest
# needs: release_create
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# ref: ${{ needs.release_create.outputs.new_sha }}
# - name: Set up Python 3.9
# uses: actions/setup-python@v5
# with:
# python-version: "3.9"
# - name: Build
# run: |
# pip install poetry
# bin/build-bin.sh
# - name: Add windows to release
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.release_create.outputs.upload_url }}
# asset_path: dist/meshtastic.exe
# asset_name: meshtastic_windows
# asset_content_type: application/zip