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

164 lines
5.8 KiB
YAML
Raw Normal View History

2024-06-11 20:53:23 +00:00
name: Actions
on:
push:
2024-10-21 16:58:05 -04:00
pull_request:
workflow_dispatch:
2024-06-11 20:53:23 +00:00
jobs:
2024-10-21 16:58:05 -04:00
docs:
name: Build Documentation
2024-10-21 16:58:05 -04:00
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
2024-06-11 20:53:23 +00:00
runs-on: docker
2025-02-13 10:41:42 -06:00
container: c.csw.im/cswimr/actions:docs
2024-06-11 20:53:23 +00:00
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
2024-10-21 13:53:40 -04:00
run: uv sync
2024-06-11 20:53:23 +00:00
- 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"
2024-10-21 13:53:40 -04:00
uv run mkdocs build -v
2024-06-11 20:53:23 +00:00
- name: Deploy documentation
run: |
2024-09-22 14:11:04 -04:00
GREEN="\\033[0;32m"
YELLOW="\\033[0;33m"
BLUE="\\033[0;34m"
2024-06-11 20:53:23 +00:00
unset GITHUB_TOKEN
unset GITLAB_TOKEN
echo "${YELLOW}Deploying to ${BLUE}Meli ${YELLOW}on branch ${GREEN}$CI_ACTION_REF_NAME_SLUG${YELLOW}...\n"
2025-02-13 10:41:42 -06:00
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"
2024-06-11 20:53:23 +00:00
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 }}
2024-10-21 16:58:05 -04:00
export:
name: Build Export Files
2024-06-11 20:53:23 +00:00
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
2024-06-11 20:53:23 +00:00
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/
2024-06-11 20:53:23 +00:00
# Prism Launcher
mkdir -vp /export/prism/minecraft/meta
2024-06-11 20:53:23 +00:00
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/
2024-06-11 20:53:23 +00:00
# Modrinth
mkdir -vp /export/modrinth/.minecraft/overrides/meta
2024-07-10 07:13:42 -04:00
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/
2024-06-11 20:53:23 +00:00
- 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/
2024-07-10 07:14:42 -04:00
continue-on-error: true
- name: Upload Modrinth export artifact
uses: actions/upload-artifact@v3
with:
name: Modrinth
path: /export/modrinth/
continue-on-error: true
2024-06-11 20:53:23 +00:00
2024-09-22 11:12:33 -04:00
autotagger:
name: Autotagger
2024-10-21 16:58:05 -04:00
if: github.event_name == 'push' && github.ref_name == 'master'
2024-06-11 20:53:23 +00:00
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:
2025-02-13 10:41:42 -06:00
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
2024-06-11 20:53:23 +00:00
- 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
2024-06-11 20:53:23 +00:00
- name: Check commit message
id: check_commit_message
run: |
2024-09-22 14:11:04 -04:00
COMMIT_MESSAGE="${{ steps.extract_commit_message.outputs.message }}"
OUTPUT="$(python .forgejo/workflows/scripts/message.py "${COMMIT_MESSAGE}")"
2024-06-11 20:53:23 +00:00
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
2024-06-11 20:53:23 +00:00
else
echo "Version bump detected: $OUTPUT"
echo "version=$OUTPUT" >> $GITHUB_OUTPUT
2024-06-11 20:53:23 +00:00
fi
- name: Create tag
if: steps.check_commit_message.outputs.version != ''
2024-06-11 20:53:23 +00:00
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 != ''
2024-06-11 20:53:23 +00:00
run: |
COMMIT_MESSAGE="${{ steps.extract_commit_message.outputs.message }}"
2024-09-22 14:11:04 -04:00
LATEST_TAG="${{ steps.check_commit_message.outputs.latest_tag }}"
2024-06-11 20:53:23 +00:00
git tag -fs $LATEST_TAG -m "$COMMIT_MESSAGE"
git push origin $LATEST_TAG --force