name: Texture Pack Packaging and Release on: push: branches: - main - master jobs: package-and-release: runs-on: ubuntu-latest timeout-minutes: 10 concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true steps: - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up ZIP tool run: sudo apt-get install zip -y - name: Create version info id: version run: | # Get current date for versioning DATE=$(date +"%Y.%m.%d") echo "VERSION=$DATE" >> $GITHUB_ENV # Update versions.txt if [ ! -f versions.txt ]; then echo "Initial version: $DATE" > versions.txt else echo "New version: $DATE" >> versions.txt fi echo "Pack version: $DATE" - name: Package texture pack run: | # Create proper Minecraft pack structure mkdir -p temp/pack cp pack/pack.mcmeta temp/pack/ cp pack/pack.png temp/pack/ cp -r pack/assets/ temp/pack/ # Create ZIP with correct structure cd temp && zip -r ../MineDivinity-Pack.zip pack/ cd .. # Generate SHA1 checksum sha1sum MineDivinity-Pack.zip > MineDivinity-Pack.sha1.txt echo "ZIP file created: MineDivinity-Pack.zip" echo "SHA1 checksum generated" - name: Configure Git run: | git config --global user.name "Gitea Actions" git config --global user.email "actions@gitea" git remote set-url origin https://x:${{ secrets.TOKEN }}@git.devbeni.lol/MineDivinity/pack.git - name: Create Tag run: | git tag -a v${{ env.VERSION }} -m "Release v${{ env.VERSION }}" git push origin v${{ env.VERSION }} - name: Commit version update run: | # Pull changes and handle potential merge conflicts git pull origin main || true # If conflict occurs, keep both version entries if git diff --name-only --diff-filter=U | grep -q "versions.txt"; then git checkout --ours versions.txt echo "New version: ${{ env.VERSION }}" >> versions.txt git add versions.txt fi git add versions.txt git commit -m "Update to version ${{ env.VERSION }} [skip ci]" || echo "No changes to commit" git push origin main - name: Create Release id: create-release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.TOKEN }} with: tag_name: v${{ env.VERSION }} release_name: MineDivinity Pack v${{ env.VERSION }} body: | Minecraft Texture Pack Release Version: ${{ env.VERSION }} Includes: - Properly structured texture pack - SHA1 checksum for verification draft: false prerelease: false - name: Upload Artifacts run: | echo "Uploading texture pack..." curl -sSL \ -X POST \ -H "Authorization: token ${{ secrets.TOKEN }}" \ -H "Content-Type: application/zip" \ --data-binary @MineDivinity-Pack.zip \ "${{ steps.create-release.outputs.upload_url }}?name=MineDivinity-Pack.zip" echo "Uploading SHA1 checksum..." curl -sSL \ -X POST \ -H "Authorization: token ${{ secrets.TOKEN }}" \ -H "Content-Type: text/plain" \ --data-binary @MineDivinity-Pack.sha1.txt \ "${{ steps.create-release.outputs.upload_url }}?name=MineDivinity-Pack.sha1.txt" echo "Artifacts uploaded successfully"