mirror of
https://github.com/fmtr/haco.git
synced 2026-10-26 10:51:46 -04:00
76 lines
2.3 KiB
YAML
76 lines
2.3 KiB
YAML
name: Version and Deploy
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version'
|
|
required: true
|
|
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
VERSION: ${{ github.event.inputs.version }}
|
|
NAME: ${{ github.event.repository.name }}
|
|
NAME_SHORT: ${{ github.event.repository.name }}
|
|
ORG: ${{ github.repository_owner }}
|
|
REBRANDLY_API_KEY: ${{ secrets.REBRANDLY_API_KEY }}
|
|
LINK_ID: ca4942821f5740fbaa46d1066b5cd7e4
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
|
|
- name: Install Tools
|
|
run: |
|
|
pip install twine tappack
|
|
|
|
- name: Increment Version
|
|
run: |
|
|
|
|
git config --global user.name 'Frontmatter Actions'
|
|
git config --global user.email 'actions@frontmatter.ai'
|
|
echo -n ${VERSION} > ${NAME}/version
|
|
python3 update_version.py ${VERSION}
|
|
tappack --module-path berry/ --output ./${NAME_SHORT}.tapp
|
|
|
|
git add ${NAME}/version
|
|
git add berry/${NAME_SHORT}_version.be
|
|
git add ha/addon/config.yaml
|
|
|
|
git commit -am "Increment version number to ${VERSION} for release"
|
|
git push
|
|
git tag -a v${VERSION} -m "Release version ${VERSION}"
|
|
git checkout --track origin/release
|
|
git rebase main
|
|
git push --follow-tags
|
|
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: haco.tapp
|
|
tag_name: v${{ github.event.inputs.version }}
|
|
generate_release_notes: true
|
|
|
|
- name: Build Wheel
|
|
run: |
|
|
python setup.py sdist bdist_wheel
|
|
|
|
- name: Push Wheel
|
|
env:
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
TWINE_USERNAME: __token__
|
|
run: |
|
|
twine upload dist/*
|
|
|
|
- name: Update Link
|
|
run: |
|
|
URL=https://github.com/${ORG}/${NAME}/releases/download/v${VERSION}/${NAME_SHORT}.tapp
|
|
DATA="{\"destination\": \"${URL}\"}"
|
|
curl --request POST --url https://api.rebrandly.com/v1/links/${LINK_ID} --header 'accept: application/json' --header "apikey: ${REBRANDLY_API_KEY}" --header 'content-type: application/json' --data "$DATA" &> /dev/null
|
|
|