Version and Deploy #25
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
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: tools | |
ORG: ${{ github.repository_owner }} | |
SHLINK_API_KEY: ${{ secrets.SHLINK_API_KEY }} | |
LINK_ID: be/tools/tapp | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Tools | |
run: | | |
pip install tappack | |
- name: Increment Version | |
env: | |
GIT_EMAIL: ${{ secrets.GIT_EMAIL }} | |
run: | | |
git config --global user.name 'Frontmatter Actions' | |
git config --global user.email "$GIT_EMAIL" | |
echo -n ${VERSION} > version | |
python3 update_version.py ${VERSION} | |
tappack --module-path module/ --output ./${NAME_SHORT}.tapp | |
git add version | |
git add module/${NAME_SHORT}_constants.be | |
git add README.md | |
git add ${NAME_SHORT}.tapp | |
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: tools.tapp | |
tag_name: v${{ github.event.inputs.version }} | |
generate_release_notes: true | |
- 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 |