diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 897db02..d7d7019 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -26,7 +26,7 @@ jobs: ext: "" - os: linux arch: arm - arm_version: 6 + arm_version: 7 ext: "" steps: @@ -76,18 +76,66 @@ jobs: OUTPUT="${APP_NAME}" if [ -n "${{ matrix.arm_version }}" ]; then - OUTPUT="${OUTPUT}v${{ matrix.arm_version }}" export GOARM=${{ matrix.arm_version }} fi - OUTPUT="${OUTPUT}${{ matrix.ext }}" + + OUTPUT="${OUTPUT}" echo "Building $OUTPUT" GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -ldflags="-s -w" -trimpath -o "$OUTPUT" shell: bash - - - name: Upload artifact + + - name: Create Debian Package + if: matrix.os == 'linux' + run: | + # 1. Setup Variables + VERSION=${GITHUB_REF_NAME#v} # Extracts 1.0.0 from v1.0.0 + ARCH=${{ matrix.arch }} + if [ "$ARCH" == "arm" ]; then ARCH="armhf"; fi + + PKG_NAME="slideshowapp" + BUILD_DIR="${PKG_NAME}_${VERSION}_${ARCH}" + + # 2. Create Directory Structure + mkdir -p $BUILD_DIR/usr/bin + mkdir -p $BUILD_DIR/usr/share/$PKG_NAME + mkdir -p $BUILD_DIR/DEBIAN + + # 3. Copy Files + cp ${APP_NAME} $BUILD_DIR/usr/bin/$PKG_NAME + cp -r ./web $BUILD_DIR/usr/share/$PKG_NAME/ + chmod +x $BUILD_DIR/usr/bin/$PKG_NAME + + # 4. Create Control File + cat < $BUILD_DIR/DEBIAN/control + Package: $PKG_NAME + Version: $VERSION + Section: utils + Priority: optional + Architecture: $ARCH + Maintainer: Your Name + Description: Slideshow Application + EOF + + # 5. Build .deb + dpkg-deb --build $BUILD_DIR + shell: bash + + # Upload for Windows (Binary + Web folder) + - name: Upload Windows Artifact + if: matrix.os == 'windows' uses: actions/upload-artifact@v3 with: - name: ${{ env.APP_NAME }}-${{ matrix.os }}-${{ matrix.arch }} + name: ${{ env.APP_NAME }}-windows path: | - ./web - ${{env.APP_NAME}}${{ matrix.ext }} + ${{ env.APP_NAME }}.exe + ./web + + # Upload for Linux (Binary + .deb) + - name: Upload Linux Artifact + if: matrix.os == 'linux' + uses: actions/upload-artifact@v3 + with: + name: ${{ env.APP_NAME }}-linux-${{ matrix.arch }} + path: | + ${{ env.APP_NAME }} + *.deb