diff --git a/.gitea/workflow/build_sd2psx.yml b/.gitea/workflow/build_sd2psx.yml new file mode 100644 index 0000000..340238d --- /dev/null +++ b/.gitea/workflow/build_sd2psx.yml @@ -0,0 +1,98 @@ +name: Build Nightly + +on: + push: + tags: + - '*' + branches: + - 'develop' + - 'main' + +env: + BUILD_TYPE: Release + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + target: [SD2PSX, SD2PSXlite, PMC+, PMCZero, PSXMemCard] + debug: [ON, OFF] + include: + - debug: ON + ext: -debug.uf2 + delay: 3 + - debug: OFF + ext: .uf2 + delay: 0 + - target: SD2PSX + filename: sd2psx + - target: SD2PSXlite + filename: sd2psxlite + - target: PMC+ + filename: pmc+ + - target: PMCZero + filename: pmczero + - target: PSXMemCard + filename: psxmemcard + steps: + - name: Clone Repository + run: | + git clone --recursive --depth=1 https://gitea.example.com/user/repo.git . + git fetch origin --tags --force + + - name: Set Version + run: | + TAG=$(git describe --tags --exact-match HEAD --exclude=latest --exclude=nightly) || true + if [ "$TAG" ]; then + echo "SD2PSX_VERSION=${TAG}" >> $GITHUB_ENV + echo "SD2PSX_RLS_TAG=latest" >> $GITHUB_ENV + echo "${TAG}" + else + echo "SD2PSX_VERSION=nightly-$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "SD2PSX_RLS_TAG=nightly" >> $GITHUB_ENV + echo "nightly" + fi + + - name: Install Dependencies + run: sudo apt-get update && sudo apt-get install -y cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib clangd git python3-venv + + - name: Build + run: | + cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DDEBUG_USB_UART:BOOL=${{ matrix.debug }} -DVARIANT:STRING=${{ matrix.target }} -DDEBUG_STARTUP_DELAY=${{ matrix.delay }} -G "Unix Makefiles" + cmake --build ${{ github.workspace }}/build + + - name: Upload Artifacts + uses: gitea/actions/upload-artifact@v1 + with: + name: ${{ matrix.filename }}${{ matrix.ext }} + path: build/${{ matrix.filename }}${{ matrix.ext }} + + create_release: + needs: [build] + runs-on: ubuntu-latest + steps: + - name: Download All Artifacts + uses: gitea/actions/download-artifact@v1 + + - name: Create Nightly Release + if: "!startsWith(github.ref, 'refs/tags/')" + uses: gitea/actions/create-release@v1 + with: + token: "${{ secrets.GITEA_TOKEN }}" + prerelease: true + tag_name: "nightly" + title: "${{ env.SD2PSX_VERSION }}" + files: | + */*.uf2 + + - name: Create Tagged Release + if: "startsWith(github.ref, 'refs/tags/')" + uses: gitea/actions/create-release@v1 + with: + token: "${{ secrets.GITEA_TOKEN }}" + prerelease: "${{ contains(github.ref, '-rc') || contains(github.ref, '-beta') }}" + tag_name: "${{ github.ref_name }}" + title: "${{ env.SD2PSX_VERSION }}" + files: | + */*.uf2