66 lines
2.5 KiB
YAML
66 lines
2.5 KiB
YAML
name: Build and host modpack
|
|
|
|
on: [push, pull_request, workflow_dispatch]
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
build_pdf:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Packwiz
|
|
run: |
|
|
apt update
|
|
apt install golang
|
|
export PATH=$PATH:/usr/local/go/bin
|
|
export PATH=$PATH:~/go/bin
|
|
go version
|
|
# go install github.com/packwiz/packwiz@latest
|
|
# packwiz --version
|
|
|
|
- name: Cache Packwiz Binary
|
|
id: cache-packwiz
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/go/bin/packwiz
|
|
key: ${{ runner.os }}-packwiz-binary
|
|
|
|
- name: Install Packwiz
|
|
if: steps.cache-packwiz.outputs.cache-hit != 'true'
|
|
run: go install github.com/packwiz/packwiz@latest
|
|
|
|
- name: Add GOBIN to Path
|
|
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
|
|
|
- name: Build modpack
|
|
run: |
|
|
packwiz modrinth export -o "${{ github.event.repository.name }}-modrinth.mrpack"
|
|
packwiz curseforge export -o "${{ githubl.event.repository.name }}-curseforge.zip"
|
|
|
|
- name: Delete old versions
|
|
continue-on-error: true
|
|
run: |
|
|
curl -v -X DELETE -s \
|
|
-u "strawberries:${{ secrets.TOKEN }}" \
|
|
"${{ github.server_url }}/api/packages/${{ github.repository_owner }}/generic/${{ github.event.repository.name }}/latest/${{ github.event.repository.name }}-modrinth.mrpack"
|
|
curl -v -X DELETE -s \
|
|
-u "strawberries:${{ secrets.TOKEN }}" \
|
|
"${{ github.server_url }}/api/packages/${{ github.repository_owner }}/generic/${{ github.event.repository.name }}/latest/${{ github.event.repository.name }}-curseforge.zip"
|
|
|
|
- name: Upload to Gitea Generic Packages
|
|
run: |
|
|
curl -v \
|
|
-u strawberries:${{ secrets.TOKEN }} \
|
|
--upload-file /${{ github.event.repository.name }}-modrinth.mrpack \
|
|
"${{ github.server_url }}/api/packages/${{ github.repository_owner }}/generic/${{ github.event.repository.name }}/latest/${{ github.event.repository.name }}-modrinth.mrpack"
|
|
curl -v \
|
|
-u strawberries:${{ secrets.TOKEN }} \
|
|
--upload-file /${{ github.event.repository.name }}-curseforge.zip \
|
|
"${{ github.server_url }}/api/packages/${{ github.repository_owner }}/generic/${{ github.event.repository.name }}/latest/${{ github.event.repository.name }}-curseforge.zip"
|
|
|