Update build&push.yml #3
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: Build and Upload FAP | ||
# Allow manual triggering of the workflow | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
build-and-upload: | ||
name: Build and Upload FAP to Latest Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Step 1: Checkout the repository | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
# Step 2: Set up Python for UFBT | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
# Step 3: Install UFBT | ||
- name: Install UFBT | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
pip install ufbt | ||
# Step 4: Initialize UFBT Environment | ||
- name: Initialize UFBT Environment | ||
run: | | ||
ufbt update | ||
ufbt vscode_dist | ||
# Step 5: Build the .fap application | ||
- name: Build FAP Application | ||
run: ufbt faps | ||
# Step 6: Get the latest release ID | ||
- name: Get Latest Release | ||
id: latest_release | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const latestRelease = await github.rest.repos.getLatestRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}); | ||
core.setOutput('upload_url', latestRelease.data.upload_url.split('{')[0]); | ||
# Step 7: Upload the .fap file to the latest release | ||
- name: Upload FAP to Latest Release | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.latest_release.outputs.upload_url }} | ||
asset_path: /home/runner/.ufbt/build/metroflip.fap | ||
asset_name: metroflip-${{ env.VERSION }}.fap | ||
asset_content_type: application/octet-stream |