💥 refactor!: rename bs.generate (#311) #19
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: 🔖 Release Modules | |
on: | |
push: | |
branches: | |
- '**' | |
permissions: | |
contents: write | |
jobs: | |
update-metadata: | |
name: 📝 Update Metadata Files | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- uses: fregante/setup-git-user@v2 | |
- uses: pdm-project/setup-pdm@v4 | |
with: | |
cache: true | |
- name: Install Dependencies | |
run: pdm install | |
- name: Update Metadata | |
run: pdm run meta update | |
- name: Commit Changes | |
run: | | |
git add . | |
git commit -m "🔖 Update generated metadata" || echo "No changes to commit" | |
git push origin HEAD:${{ github.ref }} | |
check-versions: | |
name: 🔍 Check Release Necessity | |
needs: update-metadata | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
outputs: | |
release_tag: ${{ steps.check-versions.outputs.release_tag }} | |
release_name: ${{ steps.check-versions.outputs.release_name }} | |
version_exists: ${{ steps.check-versions.outputs.version_exists }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
- name: Fetch All Tags | |
run: git fetch --tags | |
- name: Check Versions | |
id: check-versions | |
run: | | |
VERSION=$(python core/definitions.py VERSION) | |
MINECRAFT_VERSIONS=$(python core/definitions.py MINECRAFT_VERSIONS) | |
game_versions=$(echo $MINECRAFT_VERSIONS | sed 's/ /,/g') | |
echo "release_tag=v$VERSION" >> $GITHUB_OUTPUT | |
echo "release_name=v$VERSION - MC $game_versions" >> $GITHUB_OUTPUT | |
if [ -n "$(git tag -l "v$VERSION")" ]; then | |
echo "version_exists=true" >> $GITHUB_OUTPUT | |
else | |
echo "version_exists=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Debug Outputs | |
run: | | |
echo "release_tag=${{ steps.check-versions.outputs.release_tag }}" | |
echo "release_name=${{ steps.check-versions.outputs.release_name }}" | |
echo "version_exists=${{ steps.check-versions.outputs.version_exists }}" | |
create-release: | |
name: 📦 Create Release | |
needs: check-versions | |
runs-on: ubuntu-latest | |
if: ${{ needs.check-versions.outputs.version_exists == 'false' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: fregante/setup-git-user@v2 | |
- uses: pdm-project/setup-pdm@v4 | |
with: | |
cache: true | |
- name: Install Dependencies | |
run: pdm install | |
- name: Build Release Files | |
run: pdm run modules release | |
- uses: softprops/action-gh-release@v2 | |
with: | |
body_path: docs/_templates/changelog/${{ needs.check-versions.outputs.release_tag }}.md | |
name: ${{ needs.check-versions.outputs.release_name }} | |
tag_name: ${{ needs.check-versions.outputs.release_tag }} | |
make_latest: true | |
files: release/*.zip |