name: Develop Release on: workflow_dispatch: jobs: release-develop: 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 }} ref: develop fetch-depth: 0 - name: Fast Forward Develop run: | value=$(cat VERSION) develop_hash=$(git rev-parse HEAD) next_build="${{ vars.DEVELOP_BUILD }}" if [[ "$value" == *"-"* ]]; then develop_build="$((${value#*-build}))" else develop_build="0" fi git checkout origin/nightly value=$(cat VERSION) if [[ "$value" == *"-"* ]]; then nightly_build="$((${value#*-build}))" else nightly_build="0" fi echo "DEVELOP_BUILD: '${develop_build}'" echo "NIGHTLY_BUILD: '${nightly_build}'" echo "NEXT_BUILD: '${next_build}'" if (( next_build <= develop_build )); then echo "::error::NEXT_BUILD variable (${next_build}) must be greater than DEVELOP_BUILD (${develop_build})" exit 1 elif (( next_build > nightly_build )); then echo "::error::NEXT_BUILD variable (${next_build}) must be less than or equal to NIGHTLY_BUILD (${nightly_build})" exit 1 fi while : ; do value=$(cat VERSION) if [[ "$value" == *"-"* ]]; then loop_build="$((${value#*-build}))" else loop_build="1" fi if [[ "$next_build" == "$loop_build" ]]; then hash=$(git rev-parse HEAD) echo "Fast Forwarding Develop to ${hash}" git push origin ${hash}:refs/heads/develop break fi git checkout HEAD^ hash=$(git rev-parse HEAD) if [[ "$develop_hash" == "$hash" ]]; then echo "::error::No Commit found to Fast Forward" exit 1 fi done - name: Discord Success Notification uses: Kometa-Team/discord-notifications@master if: success() with: webhook_id_token: ${{ secrets.BUILD_WEBHOOK }} title: "${{ vars.REPO_NAME }} develop pushed to Build ${{ vars.DEVELOP_BUILD }}: ${{ vars.TEXT_SUCCESS }}" 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 }} develop pushed to Build ${{ vars.DEVELOP_BUILD }}: ${{ vars.TEXT_FAILURE }}" 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 }}