Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 26 additions & 158 deletions .github/workflows/addons.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,46 @@
name: Addons package

# Builds Core Rules Community Add-ons Collection, one self-installing
# AppImage with the add-ons inside (crates/cr-addons), and, on main or by
# hand, publishes it on GitHub Packages as the OCI artifact
# ghcr.io/<owner>/corerules-community-addons, tagged with the app version
# and latest, and as the file itself in the Maven registry of GitHub
# Packages, and on the release "addons", whose tag follows main: there
# CoreRules-Community-Addons-x86_64.AppImage is always the newest, for a
# download link that does not change. The zip job puts the same add-ons
# there as CoreRules-Community-Addons.zip, for Import Add-ons… in the app.
# Builds the Core Rules Community Add-ons Collection as one .zip
# (addons/tools/addons_zip.py) for Import Add-ons… in the app, on Linux,
# Windows and macOS: Comunidade.xpx with the pictures, pictures.tsv and the
# texts. On main or by hand it publishes the zip on the release "addons",
# whose tag follows main: there CoreRules-Community-Addons.zip is always the
# newest, for a download link that does not change.
on:
push:
branches: [main]
paths:
- 'addons/**'
- 'crates/cr-addons/**'
- 'data/addons/**'
- 'packaging/appimage/**'
- '.github/workflows/addons.yml'
pull_request:
paths:
- 'addons/**'
- 'crates/cr-addons/**'
- 'data/addons/**'
- 'packaging/appimage/**'
- '.github/workflows/addons.yml'
workflow_dispatch:

permissions:
contents: write
packages: write

jobs:
package:
zip:
runs-on: ubuntu-24.04
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-51
options: --privileged
steps:
- uses: actions/checkout@v4
# The checkout belongs to the runner's user; root inside the SDK
# sandbox has no capabilities to write there.
- run: chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE"
- id: v
run: echo "version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)" >> "$GITHUB_OUTPUT"
- run: packaging/appimage/build-in-sdk.sh ${{ steps.v.outputs.version }} addons
- name: Check the AppImage
- run: python3 -I addons/tools/addons_zip.py ${{ steps.v.outputs.version }} dist
- name: Check the zip
run: |
cd target/AppDir
test -x usr/bin/corerules-community-addons
test -f usr/share/icons/hicolor/256x256/apps/io.github.brahm.CoreRules.Addons.png
ls -l "$GITHUB_WORKSPACE"/dist/CoreRules-Community-Addons-*.AppImage
- if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
zip=dist/CoreRules-Community-Addons-${{ steps.v.outputs.version }}.zip
unzip -tq "$zip"
unzip -l "$zip" | grep -q 'Comunidade.xpx$'
test "$(unzip -l "$zip" | grep -ci '\.bmp$')" -ge 600
cp "$zip" dist/CoreRules-Community-Addons.zip
(cd dist && sha256sum *.zip)
- uses: actions/upload-artifact@v4
with:
name: addons-appimage
path: dist/CoreRules-Community-Addons-${{ steps.v.outputs.version }}-x86_64.AppImage
- if: github.event_name != 'pull_request'
uses: oras-project/setup-oras@v1
- if: github.event_name != 'pull_request'
name: Publish on GitHub Packages
run: |
version=${{ steps.v.outputs.version }}
owner=$(echo "$GITHUB_REPOSITORY_OWNER" | tr '[:upper:]' '[:lower:]')
echo "${{ secrets.GITHUB_TOKEN }}" | oras login ghcr.io -u "${{ github.actor }}" --password-stdin
cd dist
oras push "ghcr.io/$owner/corerules-community-addons:$version,latest" \
--artifact-type application/vnd.corerules.addons \
--annotation "org.opencontainers.image.source=https://github.com/${GITHUB_REPOSITORY}" \
--annotation "org.opencontainers.image.description=Core Rules Community Add-ons Collection: 672 community add-ons for AD&D Core Rules 2.0 Expansion, in one self-installing AppImage. Download it from https://github.com/${GITHUB_REPOSITORY}/releases/download/addons/CoreRules-Community-Addons-x86_64.AppImage or with: oras pull ghcr.io/$owner/corerules-community-addons:latest" \
--annotation "org.opencontainers.image.version=$version" \
"CoreRules-Community-Addons-$version-x86_64.AppImage:application/vnd.appimage"
name: addons-zip
path: dist/CoreRules-Community-Addons-${{ steps.v.outputs.version }}.zip
- if: github.event_name != 'pull_request'
name: Move the addons tag to this commit
uses: actions/github-script@v7
Expand All @@ -83,8 +53,6 @@ jobs:
if (e.status !== 422 && e.status !== 404) throw e;
await github.rest.git.createRef({ ...ref, ref: 'refs/tags/addons', sha: context.sha });
}
- if: github.event_name != 'pull_request'
run: cp dist/CoreRules-Community-Addons-${{ steps.v.outputs.version }}-x86_64.AppImage dist/CoreRules-Community-Addons-x86_64.AppImage
- if: github.event_name != 'pull_request'
name: Publish on the addons release
uses: softprops/action-gh-release@v2
Expand All @@ -93,119 +61,19 @@ jobs:
name: Core Rules Community Add-ons Collection
make_latest: false
body: |
The self-installing AppImage of the [Core Rules Community Add-ons Collection](https://github.com/brahm/corerules/blob/main/addons/README.md), built with Core Rules ${{ steps.v.outputs.version }}.
The [Core Rules Community Add-ons Collection](https://github.com/brahm/corerules/blob/main/addons/README.md) as one .zip, built with Core Rules ${{ steps.v.outputs.version }}: 672 community add-ons in 36,525 items, with their 668 pictures and their authors' texts.

Download **CoreRules-Community-Addons-x86_64.AppImage** (always the newest; the file with a version in its name is the same build), then:
Download **CoreRules-Community-Addons.zip** (always the newest; the file with a version in its name is the same build), then, on Linux, Windows or macOS:

```sh
chmod +x CoreRules-Community-Addons-x86_64.AppImage
./CoreRules-Community-Addons-x86_64.AppImage
```
1. Put the zip in a folder of its own. There is no need to extract it.
2. In Core Rules, choose **Import Add-ons…** (the main menu on Linux, the More menu on Windows, the File menu on the Mac) and pick that folder.
3. Check the list of what comes in and press **Import**. The app backs up `UserDbas` and `Chars` first.

On Windows, macOS or any Linux, download **CoreRules-Community-Addons.zip**, the same add-ons with their pictures and texts. In Core Rules, choose **Import Add-ons…** and pick the folder that holds the zip; there is no need to extract it. The original Expansion program can import its `Comunidade.xpx` too.
The original Expansion program can import its `Comunidade.xpx` too.

Direct link: https://github.com/${{ github.repository }}/releases/download/addons/CoreRules-Community-Addons-x86_64.AppImage
Direct link: https://github.com/${{ github.repository }}/releases/download/addons/CoreRules-Community-Addons.zip

The same file is on GitHub Packages twice: as a file, `corerules-community-addons-${{ steps.v.outputs.version }}-x86_64.AppImage`, in the Maven package `io.github.brahm.corerules-community-addons` ([the project's packages](https://github.com/${{ github.repository_owner }}?tab=packages&repo_name=${{ github.event.repository.name }})), and in the OCI package [`corerules-community-addons`](https://github.com/${{ github.repository }}/pkgs/container/corerules-community-addons): `oras pull ghcr.io/${{ github.repository_owner }}/corerules-community-addons:latest`. The app itself is on the [Core Rules releases](https://github.com/${{ github.repository }}/releases).
files: |
dist/CoreRules-Community-Addons-x86_64.AppImage
dist/CoreRules-Community-Addons-${{ steps.v.outputs.version }}-x86_64.AppImage

# The same add-ons as one .zip for Import Add-ons… in the app, on Linux,
# Windows and macOS: Comunidade.xpx with the pictures, pictures.tsv and
# the texts (addons/tools/addons_zip.py). On the addons release,
# CoreRules-Community-Addons.zip is always the newest.
zip:
needs: package
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- id: v
run: echo "version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)" >> "$GITHUB_OUTPUT"
- run: python3 -I addons/tools/addons_zip.py ${{ steps.v.outputs.version }} dist
- name: Check the zip
run: |
zip=dist/CoreRules-Community-Addons-${{ steps.v.outputs.version }}.zip
unzip -tq "$zip"
unzip -l "$zip" | grep -q 'Comunidade.xpx$'
test "$(unzip -l "$zip" | grep -ci '\.bmp$')" -ge 600
cp "$zip" dist/CoreRules-Community-Addons.zip
(cd dist && sha256sum *.zip)
- uses: actions/upload-artifact@v4
with:
name: addons-zip
path: dist/CoreRules-Community-Addons-${{ steps.v.outputs.version }}.zip
- if: github.event_name != 'pull_request'
name: Publish on the addons release
uses: softprops/action-gh-release@v2
with:
tag_name: addons
make_latest: false
The app itself is on the [Core Rules releases](https://github.com/${{ github.repository }}/releases).
files: |
dist/CoreRules-Community-Addons.zip
dist/CoreRules-Community-Addons-${{ steps.v.outputs.version }}.zip

# GitHub Packages has no registry for plain files, and its container
# registry shows the AppImage as an OCI artifact. Its Maven registry keeps
# any file as it is, with its name and extension, and the package page
# lists it under Assets for download, so the AppImage goes there too, as
# io.github.brahm:corerules-community-addons:VERSION:x86_64@AppImage. A
# version is published once, since Maven versions cannot be replaced; a
# later build of the same version only replaces the other two copies.
maven:
needs: package
if: github.event_name != 'pull_request'
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REGISTRY: https://maven.pkg.github.com/${{ github.repository }}
ARTIFACT: io/github/brahm/corerules-community-addons
steps:
- uses: actions/checkout@v4
- id: v
run: echo "version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
with:
name: addons-appimage
path: dist
# Writes ~/.m2/settings.xml with the server "github", which logs in
# as GITHUB_ACTOR with GITHUB_TOKEN.
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
server-id: github
- id: exists
name: Look for this version on GitHub Packages
run: |
version=${{ steps.v.outputs.version }}
code=$(curl -s -o /dev/null -w '%{http_code}' -u "$GITHUB_ACTOR:$GITHUB_TOKEN" \
"$REGISTRY/$ARTIFACT/$version/corerules-community-addons-$version.pom")
echo "HTTP $code"
if [ "$code" = 200 ]; then
echo "::notice::corerules-community-addons $version is already in the Maven registry; it keeps its first build"
echo "found=true" >> "$GITHUB_OUTPUT"
fi
- if: steps.exists.outputs.found != 'true'
name: Publish the AppImage on GitHub Packages (Maven)
run: |
version=${{ steps.v.outputs.version }}
mvn -B --no-transfer-progress deploy:deploy-file \
-Durl="$REGISTRY" -DrepositoryId=github \
-Dfile="dist/CoreRules-Community-Addons-$version-x86_64.AppImage" \
-DgroupId=io.github.brahm -DartifactId=corerules-community-addons \
-Dversion="$version" -Dclassifier=x86_64 -Dpackaging=AppImage \
-DgeneratePom=true \
-DgeneratePom.description="Core Rules Community Add-ons Collection: 672 community add-ons for AD&D Core Rules 2.0 Expansion, in one self-installing AppImage"
- name: Check the published AppImage
run: |
version=${{ steps.v.outputs.version }}
curl -sSfL -u "$GITHUB_ACTOR:$GITHUB_TOKEN" -o published.AppImage \
"$REGISTRY/$ARTIFACT/$version/corerules-community-addons-$version-x86_64.AppImage"
sha256sum published.AppImage "dist/CoreRules-Community-Addons-$version-x86_64.AppImage"
if [ "${{ steps.exists.outputs.found }}" != true ]; then
cmp published.AppImage "dist/CoreRules-Community-Addons-$version-x86_64.AppImage"
fi
1 change: 1 addition & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- "site/**"
- "docs/screenshots/**"
- "addons/screenshots/**"
- "addons/icon.png"
- "packaging/flatpak/repo.sh"
- ".github/workflows/pages.yml"
pull_request:
Expand Down
43 changes: 0 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
[workspace]
resolver = "3"
members = ["crates/cr-i18n", "crates/cr-formats", "crates/cr-store", "crates/cr-app", "crates/cr-cli", "crates/cr-gtk", "crates/cr-addons", "crates/cr-win", "crates/cr-mac-ffi"]
# The add-ons installer carries 9 MB of add-ons; only its own AppImage
# builds it (cargo build -p cr-addons). The Windows app is built on Windows
# (cargo build -p cr-win), and the Mac app's bridge on macOS
# (macos/scripts/make-bindings.sh).
members = ["crates/cr-i18n", "crates/cr-formats", "crates/cr-store", "crates/cr-app", "crates/cr-cli", "crates/cr-gtk", "crates/cr-win", "crates/cr-mac-ffi"]
# The Windows app is built on Windows (cargo build -p cr-win), and the Mac
# app's bridge on macOS (macos/scripts/make-bindings.sh).
default-members = ["crates/cr-i18n", "crates/cr-formats", "crates/cr-store", "crates/cr-app", "crates/cr-cli", "crates/cr-gtk"]

[workspace.package]
Expand Down
Loading
Loading