update deps #427
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: MOROway App Tag and Sync Repositories | |
on: | |
push: | |
branches: [main] | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
outputs: | |
create: ${{ steps.prepare.outputs.create }} | |
tag: ${{ steps.prepare.outputs.tag }} | |
version: ${{ steps.prepare.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare | |
id: prepare | |
shell: bash | |
run: | | |
cd build | |
beta=$(cat conf | grep "beta=" | sed 's/.*=//' | sed s/[^0-9]//g ) | |
if [[ -z "$beta" ]] || [[ "$beta" != 0 ]]; then | |
echo "create=0" >> $GITHUB_OUTPUT | |
echo "No release version" | |
exit | |
fi | |
version=$(cat conf | grep "version=" | sed 's/.*=//') | |
tag=v$version | |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
exitcode=$(git show-ref --tags --verify --quiet -- "refs/tags/$tag" && echo 0 || echo $?) | |
if [[ "$exitcode" == 0 ]]; then | |
echo "create=0" >> $GITHUB_OUTPUT | |
echo "No new version" | |
exit | |
fi | |
echo "create=1" >> $GITHUB_OUTPUT | |
echo "tag=$tag" >> $GITHUB_OUTPUT | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- if: steps.prepare.outputs.create == '1' | |
name: Tag | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: ${{ steps.prepare.outputs.tag }} | |
sync: | |
runs-on: ubuntu-latest | |
needs: tag | |
if: needs.tag.outputs.create == '1' | |
strategy: | |
matrix: | |
platform: [web] | |
include: | |
- platform: web | |
repo: moroway-app | |
branch: master | |
subdir: . | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: FedericoCarboni/setup-ffmpeg@v3 | |
with: | |
ffmpeg-version: release | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install fonttools | |
run: pip install fonttools | |
# The following step contains code from https://github.com/cpina/github-action-push-to-another-repository/ (MIT License, by cpina) | |
- name: Build moroway-app and publish to platform repository | |
shell: bash | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
GIT_USER: jonathanherrmannengel | |
GIT_MAIL: [email protected] | |
PLATFORM: ${{ matrix.platform }} | |
REPO: ${{ matrix.repo }} | |
REPO_BRANCH: ${{ matrix.branch }} | |
REPO_DIR: ${{ matrix.subdir }} | |
TAG: ${{ needs.tag.outputs.tag }} | |
VERSION: ${{ needs.tag.outputs.version }} | |
run: | | |
# Build moroway-app | |
cd build | |
changelog="$VERSION"$'\n' | |
changelogAdd=$(./build-libs/yq_linux_amd64 e ".versions .\"$VERSION\" .general | select(.)" changelogs/default/changelog.yml | sed 's/{{[0-9]\+}}\s\?//g') | |
if [[ ! -z "$changelogAdd" ]]; then | |
changelog="$changelog$changelogAdd"$'\n' | |
fi | |
changelogAdd=$(./build-libs/yq_linux_amd64 e ".versions .\"$VERSION\" .web | select(.)" changelogs/default/changelog.yml | sed 's/{{[0-9]\+}}\s\?//g') | |
if [[ ! -z "$changelogAdd" ]]; then | |
changelog="$changelog$changelogAdd"$'\n' | |
fi | |
if [[ $(cat "changelogs/meta/fixes/$VERSION") == 1 ]]; then | |
changelog="$changelog$(./build-libs/yq_linux_amd64 e ".fixes | select(.)" changelogs/default/changelog.yml)."$'\n' | |
fi | |
bash build.sh -p $PLATFORM || bash build.sh -p $PLATFORM || exit $? | |
# Publish to platform repository | |
cd ../out | |
git config --global user.email "$GIT_MAIL" | |
git config --global user.name "$GIT_USER" | |
git clone --single-branch --branch "$REPO_BRANCH" "https://$GIT_USER:[email protected]/MOROway/$REPO.git" "publish-$PLATFORM" | |
[[ ! -z $(echo "$REPO_DIR" | grep "\.\." ) ]] && exit 2 | |
rm -r publish-$PLATFORM/$REPO_DIR/* | |
cp -r $PLATFORM/latest/* publish-$PLATFORM/$REPO_DIR | |
cd publish-$PLATFORM/ | |
msg="Auto update MOROway App to new version v$VERSION" | |
git add . | |
exitcode=$(git diff-index --quiet HEAD -- && echo 0 || echo $?) | |
if [[ "$exitcode" == 1 ]]; then | |
git commit --message "$msg" | |
[[ ! -z $(git tag -l | grep -e "^$TAG$" ) ]] && git tag --delete "$TAG" && git push --delete "https://$GIT_USER:[email protected]/MOROway/$REPO.git" "$TAG" | |
git tag -a -m "$changelog" "$TAG" | |
git push "https://$GIT_USER:[email protected]/MOROway/$REPO.git" "$TAG" | |
git push "https://$GIT_USER:[email protected]/MOROway/$REPO.git" | |
fi |