This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
GalacticFactory-Legacy/.forgejo/workflows/actions.yaml
cswimr fa9a76c237
All checks were successful
Actions / Build Documentation (push) Successful in 25s
Actions / Build Export Files (push) Successful in 7s
Actions / Autotagger (push) Successful in 8s
fix workflow
2025-02-13 10:41:42 -06:00

163 lines
5.8 KiB
YAML

name: Actions
on:
push:
pull_request:
workflow_dispatch:
jobs:
docs:
name: Build Documentation
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
runs-on: docker
container: c.csw.im/cswimr/actions:docs
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: uv sync
- name: Set environment variables
uses: actions/env@v2
- name: Build documentation
run: |
export SITE_URL="https://$CI_ACTION_REF_NAME_SLUG.docs.galacticfactory.cc"
export EDIT_URI="src/branch/$CI_ACTION_REF_NAME/docs"
uv run mkdocs build -v
- name: Deploy documentation
run: |
GREEN="\\033[0;32m"
YELLOW="\\033[0;33m"
BLUE="\\033[0;34m"
unset GITHUB_TOKEN
unset GITLAB_TOKEN
echo "${YELLOW}Deploying to ${BLUE}Meli ${YELLOW}on branch ${GREEN}$CI_ACTION_REF_NAME_SLUG${YELLOW}...\n"
npx -p "@getmeli/cli" meli upload ./site --url "https://meli.csw.im" --site "${{ vars.MELI_SITE_ID }}" --token "${{ secrets.MELI_TOKEN }}" --release "$CI_ACTION_REF_NAME_SLUG/${{ env.GITHUB_SHA }}" --branch "$CI_ACTION_REF_NAME_SLUG"
echo "\n${YELLOW}Deployed to ${BLUE}Meli ${YELLOW}on branch ${GREEN}$CI_ACTION_REF_NAME_SLUG${YELLOW}!"
echo "${GREEN}https://$CI_ACTION_REF_NAME_SLUG.docs.galacticfactory.cc/"
env:
GITEA_TOKEN: ${{ secrets.COASTALCOMMITSTOKEN }}
export:
name: Build Export Files
runs-on: docker
container: catthehacker/ubuntu:act-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy export files
run: |
# ATLauncher
mkdir -vp /export/atlauncher/.minecraft/meta
cp -vrT ./build/atlauncher /export/atlauncher
cp -vp ./unsup.ini /export/atlauncher/.minecraft/
wget -O /export/atlauncher/.minecraft/galacticfactory-updater.jar https://git.sleeping.town/attachments/7edb17a2-e43f-4789-8bae-6140cbe98311
cp -vp ./LICENSE /export/atlauncher/.minecraft/meta/
cp -vp ./PERMISSIONS.md /export/atlauncher/.minecraft/meta/
# Prism Launcher
mkdir -vp /export/prism/minecraft/meta
cp -vrT ./build/prism /export/prism
cp -v ./unsup.ini /export/prism/minecraft/
cp -v ./LICENSE /export/prism/minecraft/meta/
cp -v ./PERMISSIONS.md /export/prism/minecraft/meta/
# Modrinth
mkdir -vp /export/modrinth/.minecraft/overrides/meta
cp -v ./build/modrinth.index.json /export/modrinth/
cp -v /export/atlauncher/.minecraft/galacticfactory-updater.jar /export/modrinth/.minecraft/overrides/
cp -v ./unsup.ini /export/modrinth/.minecraft/overrides/
cp -v ./LICENSE /export/modrinth/.minecraft/overrides/meta/
cp -v ./PERMISSIONS.md /export/modrinth/.minecraft/overrides/meta/
- name: Upload ATLauncher export artifact
uses: actions/upload-artifact@v3
with:
name: ATLauncher
path: /export/atlauncher/
continue-on-error: true
- name: Upload Prism Launcher export artifact
uses: actions/upload-artifact@v3
with:
name: PrismLauncher
path: /export/prism/
continue-on-error: true
- name: Upload Modrinth export artifact
uses: actions/upload-artifact@v3
with:
name: Modrinth
path: /export/modrinth/
continue-on-error: true
autotagger:
name: Autotagger
if: github.event_name == 'push' && github.ref_name == 'master'
runs-on: docker
container: catthehacker/ubuntu:act-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Git
run: |
git config --global user.name "GalacticFactory"
git config --global user.email "contact@galacticfactory.cc"
- name: Import GPG key
uses: actions/gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Extract commit message
id: extract_commit_message
shell: bash # `@Q` is bash exclusive
run: |
COMMIT_MESSAGE=$(git log --format=%B -n 1 $GITHUB_SHA)
ESCAPED_COMMIT_MESSAGE="${COMMIT_MESSAGE@Q}"
echo "Commit message: $ESCAPED_COMMIT_MESSAGE"
echo "message=$ESCAPED_COMMIT_MESSAGE" >> $GITHUB_OUTPUT
- name: Check commit message
id: check_commit_message
run: |
COMMIT_MESSAGE="${{ steps.extract_commit_message.outputs.message }}"
OUTPUT="$(python .forgejo/workflows/scripts/message.py "${COMMIT_MESSAGE}")"
if [ "$OUTPUT" = "Usage: python message.py <commit_message>" ]; then
echo "Called without commit message!"
exit 1
elif [ "$OUTPUT" = "None" ]; then
echo "No version bump."
echo "latest_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
else
echo "Version bump detected: $OUTPUT"
echo "version=$OUTPUT" >> $GITHUB_OUTPUT
fi
- name: Create tag
if: steps.check_commit_message.outputs.version != ''
run: |
VERSION=${{ steps.check_commit_message.outputs.version }}
git tag -s $VERSION -m "version bumped to $VERSION"
git push origin $VERSION
- name: Update latest tag
if: steps.check_commit_message.outputs.latest_tag != ''
run: |
COMMIT_MESSAGE="${{ steps.extract_commit_message.outputs.message }}"
LATEST_TAG="${{ steps.check_commit_message.outputs.latest_tag }}"
git tag -fs $LATEST_TAG -m "$COMMIT_MESSAGE"
git push origin $LATEST_TAG --force