Publish modpack #49
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: Publish modpack | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: "write" | |
contents: "read" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nixbuild/nix-quick-install-action@v29 | |
- name: Restore and cache Nix store | |
uses: nix-community/cache-nix-action@v5 | |
with: | |
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }} | |
restore-prefixes-first-match: nix-${{ runner.os }}- | |
gc-max-store-size: 1073741824 | |
purge: true | |
purge-prefixes: cache-${{ runner.os }}- | |
purge-created: 0 | |
purge-primary-key: never | |
- name: Verify that mods.json is up to date | |
env: | |
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }} | |
run: | | |
nix run .#lockMods | |
git diff --exit-code | |
- name: Build modpack | |
run: nix build -L --show-trace . | |
- name: Upload static files as artifact | |
id: deployment | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: result/ | |
- name: Build server container | |
run: | | |
nix build -L --show-trace .#container | |
nix run .#container.copyTo -- oci-archive:server.tar | |
- name: Upload container archive | |
id: container | |
uses: actions/upload-artifact@v4 | |
with: | |
name: server | |
path: server.tar | |
deploy-pages: | |
if: ${{ github.ref == 'refs/heads/trunk' }} | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
push-container: | |
if: ${{ github.ref == 'refs/heads/trunk' }} | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
id-token: write | |
steps: | |
- name: Download image artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: server | |
- name: Log in to registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Copy image to registry | |
run: skopeo --insecure-policy copy oci-archive:server.tar docker://ghcr.io/catgirl-v/pissfactory_server:latest |