Skip to content

Commit

Permalink
Create build&push.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
luu176 authored Dec 30, 2024
1 parent 765c751 commit 5e3dfe4
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build&push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Publish FAP to Release

on:
workflow_dispatch:

jobs:
build-and-publish:
name: Build and Publish FAP to Latest Release
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: Initialize UFBT Environment
run: |
ufbt update
ufbt vscode_dist
- name: Build FAP Applications
run: ufbt faps

- name: Archive Build Outputs
run: tar -czf build-output.tar.gz build/

- name: Get Latest Release Info
id: get-release
uses: octokit/request-action@v2
with:
route: GET /repos/${{ github.repository }}/releases/latest
continue-on-error: true

- name: Create a New Release (if latest does not exist)
if: steps.get-release.outputs.status == '404'
id: create-release
uses: actions/create-release@v1
with:
tag_name: latest
release_name: Latest Release
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Build Artifacts to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.get-release.outputs.data.html_url || steps.create-release.outputs.upload_url }}
asset_path: build-output.tar.gz
asset_name: build-output.tar.gz
asset_content_type: application/gzip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 5e3dfe4

Please sign in to comment.