-
Notifications
You must be signed in to change notification settings - Fork 2
91 lines (73 loc) · 2.77 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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 }}
SHLINK_API_KEY: ${{ secrets.SHLINK_API_KEY }}
LINK_ID: haco/tapp
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Tools
run: |
pip install twine tappack
- name: Docker Login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
run: |
echo $DOCKER_TOKEN | docker login --username $DOCKER_USER --password-stdin
- name: Increment Version
run: |
git config --global user.name 'Frontmatter Actions'
git config --global user.email '[email protected]'
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="{\"longUrl\": \"${URL}\"}"
curl --request PATCH --url https://fmtr.link/rest/v3/short-urls/${LINK_ID} --header "Content-Type: application/json" --header "X-Api-Key: ${SHLINK_API_KEY}" --data "$DATA" &> /dev/null
- name: Build Docker
run: |
docker build . --build-arg TYPE=release --build-arg VERSION=${VERSION} --tag fmtr/${NAME}:v${VERSION}
docker tag fmtr/${NAME}:v${VERSION} fmtr/${NAME}:latest
- name: Push Docker
run: |
docker push --all-tags fmtr/${NAME}