Skip to content

Commit

Permalink
add release workflow (#21)
Browse files Browse the repository at this point in the history
Signed-off-by: Tiger Wang <[email protected]>
  • Loading branch information
tigerinus authored Mar 1, 2023
1 parent 400bd5d commit 741e0f5
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: release

on:
push:
tags:
- v*.*.*

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: remove all screenshots
run: find . -name "screenshot*" | xargs rm -f
- name: remove all thumbnails
run: find . -name "thumbnail*" | xargs rm -f
- name: create a build with sysroot
id: build
run: |
rm -rf /tmp/build
mkdir -p /tmp/build/sysroot/var/lib/casaos/appstore/default.new
cp -rv build/* /tmp/build/
cp -rv Apps /tmp/build/sysroot/var/lib/casaos/appstore/default.new/
cp -v category-list.json /tmp/build/sysroot/var/lib/casaos/appstore/default.new/
cp -v recommend-list.json /tmp/build/sysroot/var/lib/casaos/appstore/default.new/
cp -v README.md /tmp/build/sysroot/var/lib/casaos/appstore/default.new/
pushd /tmp
tar zcvf linux-all-appstore-${{ github.ref_name }}.tar.gz build
- uses: softprops/action-gh-release@v1
if: steps.build.outcome == 'success'
with:
files: /tmp/linux-all-appstore-${{ github.ref_name }}.tar.gz
draft: true
prerelease: true
fail_on_unmatched_files: true
30 changes: 30 additions & 0 deletions build/scripts/setup/script.d/99-setup-appstore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -e

DEFAULT_APPSTORE_PATH="/var/lib/casaos/appstore/default"

if [ -d "${DEFAULT_APPSTORE_PATH}" ]; then
echo "🟩 Backup existing default appstore..."
mv -f "${DEFAULT_APPSTORE_PATH}" "${DEFAULT_APPSTORE_PATH}.old" || {
echo "🟥 Failed to backup existing default appstore"
exit 1
}
fi

echo "🟩 Updating default appstore..."

if [ -d "${DEFAULT_APPSTORE_PATH}.new" ]; then
mv -vf "${DEFAULT_APPSTORE_PATH}.new" "${DEFAULT_APPSTORE_PATH}" || {
echo "🟥 Failed to update default appstore... restoring backup..."
rm -vf "${DEFAULT_APPSTORE_PATH}"
mv -vf "${DEFAULT_APPSTORE_PATH}.old" "${DEFAULT_APPSTORE_PATH}"
rm -rvf "${DEFAULT_APPSTORE_PATH}.new"
exit 1
}
rm -rvf "${DEFAULT_APPSTORE_PATH}.old" || {
echo "🟨 Failed to remove old default appstore backup"
}
else
echo "🟨 New default appstore does not exist"
fi

0 comments on commit 741e0f5

Please sign in to comment.