name: UFBT Build and Release permissions: contents: write on: push: branches: - main pull_request: branches: - main jobs: build: name: Build and Test runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install UFBT run: | python3 -m pip install --upgrade pip pip install ufbt - name: Extract Version from Manifest id: extract_version run: | VERSION=$(grep '^version:' manifest.yml | awk '{print $2}') echo "VERSION=${VERSION}" >> $GITHUB_ENV - name: Initialize UFBT Environment run: | ufbt update ufbt vscode_dist - name: Build FAP Applications run: ufbt faps - name: Rename and Move FAP File run: | mkdir -p build/fap mv /home/runner/.ufbt/build/metroflip.fap build/fap/metroflip-${{ env.VERSION }}.fap - name: Upload Build Artifacts if: github.event_name == 'pull_request' uses: actions/upload-artifact@v3 with: name: metroflip-build path: build/fap/metroflip-${{ env.VERSION }}.fap release: name: Create Release needs: build if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v3 - name: Extract Version from Manifest id: extract_version run: | VERSION=$(grep '^version:' manifest.yml | awk '{print $2}') echo "VERSION=${VERSION}" >> $GITHUB_ENV - name: Create Release uses: actions/create-release@v1 with: tag_name: v${{ env.VERSION }} release_name: Metroflip v${{ env.VERSION }} body: | **What's New:** $(cat CHANGELOG.md) draft: false prerelease: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload FAP File to Release uses: actions/upload-release-asset@v1 with: release_id: ${{ steps.create-release.outputs.id }} asset_path: build/fap/metroflip-${{ env.VERSION }}.fap asset_name: metroflip-${{ env.VERSION }}.fap asset_content_type: application/octet-stream