From c9593baf5da5eefb992d5036b97253a5c91f08b0 Mon Sep 17 00:00:00 2001 From: Nick Koirala Date: Mon, 8 Dec 2025 16:44:35 +1300 Subject: [PATCH] feat: added gitea actions --- .gitea/workflows/build.yml | 105 +++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..6e2cdce --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,105 @@ +name: Build TIC-80 Cartridge + +on: + push: + branches: + - main + - master + tags: + - 'v*' + +jobs: + build-cartridge: + name: Build PNG Cartridge + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install TIC-80 + run: | + wget -q https://github.com/nesbox/TIC-80/releases/download/v1.1.2837/tic80-v1.1-linux.zip + unzip -q tic80-v1.1-linux.zip + chmod +x tic80 + + - name: Export PNG cartridge + run: | + ./tic80 --skip --cli --cmd="load lucksmith.lua & export lucksmith.png & exit" + + - name: Upload PNG cartridge as artifact + uses: actions/upload-artifact@v4 + with: + name: lucksmith-cartridge + path: lucksmith.png + + - name: Commit PNG cartridge + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: | + git config user.name "Gitea Actions" + git config user.email "actions@gitea.local" + git add lucksmith.png + git diff --staged --quiet || git commit -m "Update PNG cartridge [skip ci]" + git push + + build-releases: + name: Build Releases + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + needs: build-cartridge + strategy: + matrix: + include: + - platform: linux + url: https://github.com/nesbox/TIC-80/releases/download/v1.1.2837/tic80-v1.1-linux.zip + binary: tic80 + - platform: windows + url: https://github.com/nesbox/TIC-80/releases/download/v1.1.2837/tic80-v1.1-windows.zip + binary: tic80.exe + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download TIC-80 + run: | + wget -q ${{ matrix.url }} -O tic80.zip + unzip -q tic80.zip + + - name: Download PNG cartridge + uses: actions/download-artifact@v4 + with: + name: lucksmith-cartridge + + - name: Prepare release package + run: | + mkdir -p release + cp ${{ matrix.binary }} release/ + cp lucksmith.png release/ + cp lucksmith.lua release/ + cd release + if [ "${{ matrix.platform }}" = "windows" ]; then + zip -r ../lucksmith-${{ matrix.platform }}.zip . + else + tar czf ../lucksmith-${{ matrix.platform }}.tar.gz . + fi + + - name: Create Release + uses: actions/create-release@v1 + id: create_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + release_name: Release ${{ github.ref_name }} + draft: false + prerelease: false + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./lucksmith-${{ matrix.platform }}.${{ matrix.platform == 'windows' && 'zip' || 'tar.gz' }} + asset_name: lucksmith-${{ matrix.platform }}-${{ github.ref_name }}.${{ matrix.platform == 'windows' && 'zip' || 'tar.gz' }} + asset_content_type: application/${{ matrix.platform == 'windows' && 'zip' || 'gzip' }} -- 2.20.1