Mindustry/.github/workflows/deployment.yml

94 lines
3.4 KiB
YAML
Raw Normal View History

2020-11-20 06:53:02 +07:00
name: Deployment
on:
push:
tags:
- 'v*'
permissions: {}
2020-11-20 06:53:02 +07:00
jobs:
2021-06-14 22:05:37 +07:00
deploy:
permissions:
contents: write # for release creation (svenstaro/upload-release-action)
2020-11-20 06:53:02 +07:00
runs-on: ubuntu-latest
steps:
2020-11-20 07:27:21 +07:00
- uses: actions/checkout@v2
2022-05-11 06:43:47 +07:00
- name: Set up JDK 17
2020-11-20 06:53:02 +07:00
uses: actions/setup-java@v1
with:
2022-05-11 06:43:47 +07:00
java-version: 17
2020-11-28 21:43:35 +07:00
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Add Arc release
run: |
2023-02-21 02:19:36 +07:00
git config --global user.email "actions@github.com"
git config --global user.name "Github Actions"
git clone --depth=1 --branch=master https://github.com/Anuken/Arc ../Arc
cd ../Arc
git tag ${RELEASE_VERSION}
git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/Arc ${RELEASE_VERSION};
cd ../Mindustry
2022-05-11 07:46:53 +07:00
- name: Update JITpack repo
run: |
cd ../
cp -r ./Mindustry ./MindustryJitpack
cd MindustryJitpack
2022-07-16 22:04:44 +07:00
git config --global user.name "Github Actions"
git config --global user.email "actions@github.com"
2022-05-11 07:46:53 +07:00
git clone --depth 1 https://github.com/Anuken/MindustryJitpack.git
rm -rf .git
cp -r ./MindustryJitpack/.git ./.git
rm -rf MindustryJitpack
rm -rf .github
rm README.md
git add .
2022-05-11 07:50:36 +07:00
git commit --allow-empty -m "${GITHUB_SHA}"
2022-05-11 07:46:53 +07:00
git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryJitpack
git tag ${RELEASE_VERSION}
git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryJitpack
cd ../Mindustry
2020-11-20 06:53:02 +07:00
- name: Create artifacts
run: |
./gradlew desktop:dist server:dist core:mergedJavadoc -Pbuildversion=${RELEASE_VERSION:1}
2020-11-20 06:53:02 +07:00
- name: Update docs
run: |
cd ../
git config --global user.email "cli@github.com"
git config --global user.name "Github Actions"
2020-11-20 06:53:02 +07:00
git clone --depth=1 https://github.com/MindustryGame/docs.git
cd docs
find . -maxdepth 1 ! -name ".git" ! -name . -exec rm -r {} \;
cd ../
cp -a Mindustry/core/build/javadoc/. docs/
2020-11-20 06:53:02 +07:00
cd docs
git add .
2021-07-29 05:20:08 +07:00
git commit --allow-empty -m "Update ${RELEASE_VERSION:1}"
2020-11-20 07:39:40 +07:00
git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/MindustryGame/docs
2020-11-20 06:53:02 +07:00
cd ../Mindustry
- name: Update F-Droid build string
run: |
git clone --depth=1 --branch=master https://github.com/Anuken/MindustryBuilds ../MindustryBuilds
cd ../MindustryBuilds
2020-11-28 21:43:35 +07:00
echo "Updating version to ${RELEASE_VERSION:1}"
2021-07-04 08:42:19 +07:00
BNUM=$(($GITHUB_RUN_NUMBER + 1000))
echo versionName=7-fdroid-${RELEASE_VERSION:1}$'\n'versionCode=${BNUM} > version_fdroid.txt
2020-11-20 06:53:02 +07:00
git add .
2020-11-28 21:43:35 +07:00
git commit -m "Updating to build ${RELEASE_VERSION:1}"
git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryBuilds
2020-11-20 06:53:02 +07:00
cd ../Mindustry
- name: Upload client artifacts
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
2020-11-25 23:09:29 +07:00
file: desktop/build/libs/Mindustry.jar
2020-11-20 06:53:02 +07:00
tag: ${{ github.ref }}
- name: Upload server artifacts
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
2020-11-25 23:09:29 +07:00
file: server/build/libs/server-release.jar
2020-11-20 06:53:02 +07:00
tag: ${{ github.ref }}