mirror of
https://github.com/Astatin3/meteorbot-old.git
synced 2026-06-09 00:28:06 -06:00
Initial commit
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
name: Automatic Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
- '.github/ISSUE_TEMPLATE/'
|
||||
- 'Assets/'
|
||||
- 'Visuals/'
|
||||
- '.gitignore'
|
||||
- 'LICENSE'
|
||||
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: write
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
|
||||
jobs:
|
||||
build_os_matrix:
|
||||
name: ${{ matrix.config.name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- {
|
||||
name: Windows,
|
||||
os: windows-latest
|
||||
}
|
||||
- {
|
||||
name: Linux,
|
||||
os: ubuntu-latest
|
||||
}
|
||||
uses: ./.github/workflows/botcraft_build.yml
|
||||
with:
|
||||
os: ${{ matrix.config.os }}
|
||||
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build_os_matrix
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# Fetch depth 0 to get all tags and commits to generate release note changelog
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download Windows artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: botcraft-Windows
|
||||
path: windows
|
||||
|
||||
- name: Download Linux artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: botcraft-Linux
|
||||
path: linux
|
||||
|
||||
- name: Download doc artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: botcraft-doc
|
||||
path: doc
|
||||
|
||||
- name: Download version artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: MC-version
|
||||
path: version
|
||||
|
||||
- name: Retrieve MC game version
|
||||
id: mc-version
|
||||
run: echo "version=$(cat version/version.txt)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create release note
|
||||
run: |
|
||||
echo Automatically built library with the latest version of the code for Minecraft ${{ steps.mc-version.outputs.version }} and all options enabled. Examples are in \`\`bin\`\` folder. If you want to run any example other than 0_HelloWorld and 3_SimpleAFKExample, you first need to run the provided \`\`download_mc_assets\`\` script to automatically populate the \`\`Assets\`\` folder by downloading and extracting the official Minecraft client. > release_note.txt
|
||||
echo -en '\n' >> release_note.txt
|
||||
echo "If you are on Windows < 10, the script won't work and you'll have to do it manually as curl and tar commands have only been added recently." >> release_note.txt
|
||||
echo Linux version is compiled using Ubuntu with all dependencies included and should work on other distributions. You might have to install the unzip command to run the script though. >> release_note.txt
|
||||
echo -en '\n' >> release_note.txt
|
||||
echo "💡 If you need binaries for a previous version of Minecraft, you can open [an issue using this link](https://github.com/${{ github.repository }}/issues/new?assignees=&labels=version+request&template=version-request.yml&title=%5BVersion+request%5D) and it will be automagically generated for you." >> release_note.txt
|
||||
echo -en '\n' >> release_note.txt
|
||||
echo **Changes:** >> release_note.txt
|
||||
|
||||
- name: Append git commits
|
||||
run: git log latest..HEAD --oneline --no-merges >> release_note.txt
|
||||
|
||||
- name: Rename artifacts
|
||||
run: |
|
||||
mv linux/botcraft.zip botcraft-linux-${{ steps.mc-version.outputs.version }}.zip
|
||||
mv windows/botcraft.zip botcraft-windows-${{ steps.mc-version.outputs.version }}.zip
|
||||
mv doc/doc.zip botcraft-doc-${{ steps.mc-version.outputs.version }}.zip
|
||||
|
||||
- name: Remove old latest release
|
||||
run: gh release delete latest --repo ${{ github.repository }} --cleanup-tag -y
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
- name: Create new latest release
|
||||
run: >
|
||||
gh release create latest
|
||||
botcraft-linux-${{ steps.mc-version.outputs.version }}.zip
|
||||
botcraft-windows-${{ steps.mc-version.outputs.version }}.zip
|
||||
botcraft-doc-${{ steps.mc-version.outputs.version }}.zip
|
||||
--repo ${{ github.repository }}
|
||||
--latest
|
||||
-F release_note.txt
|
||||
-t Latest
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
|
||||
deploy_doc:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
needs:
|
||||
- build_os_matrix
|
||||
# Only deploy the doc if a release was successfully created
|
||||
- release
|
||||
|
||||
steps:
|
||||
- name: Download doc artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: botcraft-doc
|
||||
path: doc
|
||||
|
||||
- name: Download version artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: MC-version
|
||||
path: version
|
||||
|
||||
- name: Unzip doc
|
||||
working-directory: doc
|
||||
run: cmake -E tar "xzf" "doc.zip"
|
||||
|
||||
- name: Rename version folder
|
||||
run: mv doc/$(cat version/version.txt) doc/doc
|
||||
|
||||
- name: Upload raw doc files for pages
|
||||
uses: actions/upload-pages-artifact@v1
|
||||
with:
|
||||
path: doc/doc
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
# Will automatically fetch the artifact "github-pages" uploaded using actions/upload-pages-artifact@v1
|
||||
uses: actions/deploy-pages@v2
|
||||
Reference in New Issue
Block a user