Plex-Meta-Manager/.github/workflows/release-master.yml

87 lines
3.1 KiB
YAML
Raw Normal View History

2024-05-31 09:59:14 -04:00
name: Master Release
2024-05-28 16:59:00 -04:00
on:
workflow_dispatch:
inputs:
release_type:
type: choice
description: Choose which type of release to perform.
options:
- major
- minor
- patch
default: patch
2024-05-28 16:59:00 -04:00
jobs:
2024-05-31 09:59:14 -04:00
release-master:
2024-05-28 16:59:00 -04:00
runs-on: ubuntu-latest
steps:
- name: Create App Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_TOKEN }}
- name: Check Out Repo
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
2024-05-30 16:59:29 -04:00
ref: nightly
2024-05-28 16:59:00 -04:00
fetch-depth: 0
2024-05-30 16:59:29 -04:00
- name: Create Release Commit and Synchronize Branches
2024-05-28 16:59:00 -04:00
run: |
2024-05-30 16:59:29 -04:00
value=$(cat VERSION)
version="${value%-build*}"
echo "CURRENT_VERSION: '${version}'"
IFS='.' read -r MAJOR MINOR PATCH <<< "$version"
2024-05-30 16:59:29 -04:00
if [[ "${{ github.event.inputs.release_type }}" == "major" ]]; then
NEW_VERSION="$((MAJOR+1)).0.0"
elif [[ "${{ github.event.inputs.release_type }}" == "minor" ]]; then
NEW_VERSION="${MAJOR}.$((MINOR+1)).0"
else
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH+1))"
2024-05-30 16:59:29 -04:00
fi
echo "NEW_VERSION='${NEW_VERSION}'"
echo "new_ver=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "$NEW_VERSION" > "VERSION"
2024-05-30 16:59:29 -04:00
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add VERSION
git commit -m "Kometa Release ${NEW_VERSION}"
2024-05-30 16:59:29 -04:00
git push origin nightly
git push origin refs/heads/nightly:refs/heads/develop
git push origin refs/heads/nightly:refs/heads/main
2024-05-31 09:59:14 -04:00
- name: Discord Success Notification
uses: Kometa-Team/discord-notifications@master
if: success()
with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }}
title: "${{ vars.REPO_NAME }} master release ${{ steps.release.outputs.new_ver }}: ${{ vars.TEXT_SUCCESS }}"
2024-05-31 09:59:14 -04:00
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }}
color: ${{ vars.COLOR_SUCCESS }}
username: ${{ vars.BOT_NAME }}
avatar_url: ${{ vars.BOT_IMAGE }}
author: ${{ vars.GIT_NAME }}
author_icon_url: ${{ vars.GIT_IMAGE }}
- name: Discord Failure Notification
uses: Kometa-Team/discord-notifications@master
if: failure()
with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }}
message: ${{ vars.BUILD_FAILURE_ROLE }}
title: "${{ vars.REPO_NAME }} master release ${{ steps.release.outputs.new_ver }}: ${{ vars.TEXT_FAILURE }}"
2024-05-31 09:59:14 -04:00
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }}
color: ${{ vars.COLOR_FAILURE }}
username: ${{ vars.BOT_NAME }}
avatar_url: ${{ vars.BOT_IMAGE }}
author: ${{ vars.GIT_NAME }}
author_icon_url: ${{ vars.GIT_IMAGE }}