From becc6d6c6963bd3d10f6408aad516f4da41c9d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Hrivn=C3=A1k?= Date: Tue, 27 Aug 2024 15:34:16 +0200 Subject: [PATCH] Update workflows --- .github/workflows/BuildMultiplatform.yml | 13 ++++++ .github/workflows/Release.yml | 57 ++++++++++++++---------- 2 files changed, 46 insertions(+), 24 deletions(-) diff --git a/.github/workflows/BuildMultiplatform.yml b/.github/workflows/BuildMultiplatform.yml index e5590115..0283f809 100644 --- a/.github/workflows/BuildMultiplatform.yml +++ b/.github/workflows/BuildMultiplatform.yml @@ -17,6 +17,7 @@ jobs: projectname: ${{ steps.info.outputs.projectname }} projectsuffix: ${{ steps.info.outputs.projectsuffix }} tag: ${{ steps.info.outputs.tag }} + rel_type: ${{ steps.info.outputs.rel_type }} diff: ${{ steps.info.outputs.diff }} steps: @@ -71,6 +72,18 @@ jobs: echo "📃 projectsuffix=build.${{ github.run_number }}" fi + # -- RELEASE TYPE + + rel_type="release" + case $latest_tag in + *alpha*) rel_type="alpha" ;; + *beta*) rel_type="beta" ;; + *) rel_type="release" ;; + esac + + echo "rel_type=$rel_type" >> $GITHUB_OUTPUT + echo "📃 rel_type=$rel_type" + # -- DIFF -- latest_tagged_commit=$(git rev-list -n 1 --pretty=format:"%h" $latest_tag | sed -n 2p) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index cd574d30..cf38317c 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -10,18 +10,23 @@ on: projectsuffix: required: true type: string - mcversion: + tag: required: true type: string - tag: + rel_type: + required: true + type: string + mcversion: required: true type: string news: required: true type: string +# Project IDs of the modpack. env: - PROJECT_ID: "399664" + CF_PROJECT_ID: "399664" + MR_PROJECT_ID: "ZmoIrOsS" jobs: release-github: @@ -32,14 +37,17 @@ jobs: uses: actions/download-artifact@v4 with: name: modpack + - name: Download serverpack uses: actions/download-artifact@v4 with: name: serverpack + - name: Download changelog uses: actions/download-artifact@v4 with: name: changelog + - name: Create release uses: softprops/action-gh-release@v2 with: @@ -55,55 +63,50 @@ jobs: name: Deploy to CurseForge runs-on: ubuntu-latest steps: - - name: Check if CF_API_TOKEN exist + - name: Check if CF_TOKEN exist shell: bash run: | - if [ "${{ secrets.CF_API_TOKEN }}" == '' ]; then - echo '::error::No value found for secret key `CF_API_TOKEN`. See https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository' && exit 1 + if [ "${{ secrets.CF_TOKEN }}" == '' ]; then + echo '::error::No value found for secret key `CF_TOKEN`. See https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository' && exit 1 fi + - name: Download modpack uses: actions/download-artifact@v4 with: name: modpack + - name: Download serverpack uses: actions/download-artifact@v4 with: name: serverpack - - name: Get release type - id: release_type - run: | - rel_type="release" - case "${{ inputs.tag }}" in - *alpha*) rel_type="alpha" ;; - *beta*) rel_type="beta" ;; - *) rel_type="release" ;; - esac - echo "type=$rel_type" >> $GITHUB_OUTPUT + - name: Create release id: cf_release uses: itsmeow/curseforge-upload@v3.1.2 with: - token: ${{ secrets.CF_API_TOKEN }} - project_id: ${{ env.PROJECT_ID }} + token: ${{ secrets.CF_TOKEN }} + project_id: ${{ env.CF_PROJECT_ID }} file_path: ${{ inputs.projectname }}-${{ inputs.projectsuffix }}.zip display_name: ${{ inputs.projectname }}-${{ inputs.projectsuffix }} changelog: See https://github.com/juraj-hrivnak/Underdog/releases/tag/${{ inputs.tag }} changelog_type: markdown game_versions: ${{ inputs.mcversion }} game_endpoint: minecraft - release_type: ${{ steps.release_type.outputs.type }} + release_type: ${{ inputs.rel_type }} + - name: Upload server pack uses: itsmeow/curseforge-upload@v3.1.2 with: - token: ${{ secrets.CF_API_TOKEN }} + token: ${{ secrets.CF_TOKEN }} parent_file_id: ${{ steps.cf_release.outputs.id }} - project_id: ${{ env.PROJECT_ID }} + project_id: ${{ env.CF_PROJECT_ID }} file_path: ${{ inputs.projectname }}-${{ inputs.projectsuffix }}-Server-Pack.zip display_name: ${{ inputs.projectname }}-${{ inputs.projectsuffix }}-Server-Pack changelog: See https://github.com/juraj-hrivnak/Underdog/releases/tag/${{ inputs.tag }} changelog_type: markdown game_endpoint: minecraft - release_type: ${{ steps.release_type.outputs.type }} + release_type: ${{ inputs.rel_type }} + - name: Create Discord message id: message shell: bash @@ -114,13 +117,15 @@ jobs: message+="[Issues]()\n" message+="### What's new?\n${{ inputs.news }}" echo "markdown=$message" >> $GITHUB_OUTPUT + - name: Send Discord message uses: "hugoalh/send-discord-webhook-ghaction@v6.0.2" with: - key: ${{ secrets.DISCORD_WEBHOOK_2 }} - content: "${{ steps.message.outputs.markdown }}" + key: ${{ secrets.DISCORD_WEBHOOK_ANNOUNCEMENTS }} username: "UnderBot" avatar_url: "https://media.forgecdn.net/avatars/828/211/638215807562150866.png" + content: "${{ steps.message.outputs.markdown }}" + embeds: "[{}]" update-changelogs: name: Update Changelogs @@ -129,21 +134,25 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Download changelog uses: actions/download-artifact@v4 with: name: changelog path: pax/changelogs + - name: Move changelogs run: | rm CHANGELOG.md cp pax/changelogs/TEMPLATE.md CHANGELOG.md + - name: Commit changelogs run: | git add . git config --local user.name "Juraj Hrivnak" git config --local user.email "juraj-hrivnak@users.noreply.github.com" git commit -m "Automatically update changelogs" -a + - name: Push changelogs uses: ad-m/github-push-action@v0.8.0 with: