name: Build and Release modpack on: push: tags: - '**' permissions: contents: read packages: write jobs: release: name: Create Release from tag runs-on: k3s container: volumes: - server:/out/server - client:/out/client - curse:/out/curse steps: - name: Checkout Repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: Checkout Actions and Workflows uses: actions/checkout@v4 with: repository: operations/gitea-actions token: ${{ secrets.BOT_TOKEN }} fetch-depth: 0 path: .gitea/actions ref: master - name: Create configuration references id: config uses: ./.gitea/actions/job-configuration with: service_name: atm10 project: minecraft oci_registry: gitea.marquis.site - name: Run build tool uses: docker://gitea.marquis.site/operations/modpack_buildah/modpack_buildah env: MODPACK__VERSION: "${{ github.ref_name }}" CURSEFORGE_APIKEY: "${{ secrets.CURSEFORGE_APIKEY }}" - name: Build and Push Container image for the Server run: | docker login ${IMAGE_URL} --username gitAutomationBot --password ${{ secrets.BOT_TOKEN }} docker build -t ${IMAGE_URL}:${{ github.ref_name }} --network host /out/server docker tag ${IMAGE_URL}:${{ github.ref_name }} ${IMAGE_URL}:latest docker push ${IMAGE_URL}:${{ github.ref_name }} docker push ${IMAGE_URL}:latest env: IMAGE_URL: ${{ steps.config.outputs.image_path }}/${{ steps.config.outputs.image_name }} - name: "Push new client version to repository" run: | git fetch origin +refs/heads/main git checkout main rm -rf ./minecraft/mods cp -r /out/client/* . git config user.name gitAutomationBot git config user.email service+git@marquis.site git add . -- :!.gitea/* git commit -m "Version ${{ github.ref_name }}" git push origin main - name: "Create Gitea Release for Curse Modpack" uses: akkuman/gitea-release-action@v1 if: ${{ failure() || success() }} with: name: "Version ${{ github.ref_name }} (${{ steps.config.outputs.version }})" body: > Modpack Server container image: `${{ steps.config.outputs.image_path }}/${{ steps.config.outputs.image_name }}:${{ github.ref_name }}` files: |- /out/curse/*-${{ github.ref_name }}.zip - name: "Send notification" uses: ivanmilov/telegram_notify_action@v1 with: api_key: ${{ secrets.TELEGRAM_API_KEY }} chat_id: ${{ vars.TELEGRAM_CHAT_ID }} message: > Modpack **ATM 10** just got updated to version **${{ github.ref_name }}**! Go to ${{ vars.SERVER_PUBLIC_URL }}/${{ github.repository }} to get instructions on how to update or [download the newest Modpack zip directly](${{ vars.SERVER_PUBLIC_URL }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}).