Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
juraj-hrivnak committed Aug 27, 2024
1 parent a541c5c commit becc6d6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 24 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/BuildMultiplatform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
57 changes: 33 additions & 24 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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/[email protected]
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/[email protected]
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
Expand All @@ -114,13 +117,15 @@ jobs:
message+="[Issues](<https://github.com/juraj-hrivnak/Underdog/issues>)\n"
message+="### What's new?\n${{ inputs.news }}"
echo "markdown=$message" >> $GITHUB_OUTPUT
- name: Send Discord message
uses: "hugoalh/[email protected]"
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
Expand All @@ -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 "[email protected]"
git commit -m "Automatically update changelogs" -a
- name: Push changelogs
uses: ad-m/[email protected]
with:
Expand Down

0 comments on commit becc6d6

Please sign in to comment.