Skip to content

Commit

Permalink
ci: add release code
Browse files Browse the repository at this point in the history
  • Loading branch information
josegonzalez committed Dec 31, 2024
1 parent 278ab50 commit 95cf951
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.github export-ignore
.gitattributes export-ignore
52 changes: 52 additions & 0 deletions .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: "bump-version"

# yamllint disable-line rule:truthy
on:
workflow_dispatch:
inputs:
bump_type:
description: "Bump type"
default: "patch"
required: true
type: choice
options:
- patch
- minor
- major

env:
GITHUB_ACCESS_TOKEN: ${{ secrets.TRIMUI_ACCESS_TOKEN }}

jobs:
bump-version:
name: bump-version
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v4.1.4
with:
fetch-depth: 0
token: ${{ env.GITHUB_ACCESS_TOKEN }}

- name: Get Latest Tag
id: latest-tag
run: |
echo GIT_LATEST_TAG="$(git describe --tags "$(git rev-list --tags --max-count=1)")" >>"$GITHUB_OUTPUT"
- name: Compute Next Tag
id: next-tag
uses: docker://ghcr.io/dokku/semver-generator:latest
with:
bump: ${{ github.event.inputs.bump_type }}
input: ${{ steps.latest-tag.outputs.GIT_LATEST_TAG }}

- name: Create and Push Tag
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git tag "$GIT_NEXT_TAG"
git push origin "$GIT_NEXT_TAG"
env:
GIT_NEXT_TAG: ${{ steps.next-tag.outputs.version }}
47 changes: 47 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: "ci"

# yamllint disable-line rule:truthy
on:
pull_request:
branches:
- "*"
push:
branches:
- main

permissions:
attestations: write
id-token: write
contents: write

jobs:
ci:
name: ci
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get Pak Name
id: pak-name
run: |
echo "PAK_NAME=$(jq -r .label config.json)" >> $GITHUB_OUTPUT
- name: Create Release zip
run: |
mkdir -p dist
git archive --format=zip --output "dist/${{ steps.pak-name.outputs.PAK_NAME }}.pak.zip" HEAD
ls -lah dist
- name: Attest Build Provenance
uses: actions/attest-build-provenance@v2.1.0
with:
subject-path: "dist/${{ steps.pak-name.outputs.PAK_NAME }}.pak.zip"

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*
51 changes: 51 additions & 0 deletions .github/workflows/tagged-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: "tagged-release"

# yamllint disable-line rule:truthy
on:
push:
tags:
- "*"

permissions:
attestations: write
id-token: write
contents: write

jobs:
tagged-release:
name: tagged-release
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get Pak Name
id: pak-name
run: |
echo "PAK_NAME=$(jq -r .label config.json)" >> $GITHUB_OUTPUT
- name: Create Release zip
run: |
mkdir -p dist
git archive --format=zip --output "dist/${{ steps.pak-name.outputs.PAK_NAME }}.pak.zip" HEAD
ls -lah dist
- name: Attest Build Provenance
uses: actions/attest-build-provenance@v2.1.0
with:
subject-path: "dist/${{ steps.pak-name.outputs.PAK_NAME }}.pak.zip"

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*

- name: Release
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true
make_latest: "true"
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ A TrimUI Brick app wrapping the built-in Function Key Editor app.
## Installation

1. Mount your TrimUI Brick SD card.
2. Create a folder in your SD card with the full-path of `/Tools/tg3040/FN Editor.pak`.
3. Copy `launch.sh` to that folder, ensuring it is still executable.
4. Unmount your SD Card and insert it into your TrimUI Brick.
2. Download the latest release from Github. It will be named `FN.Editor.pak.zip`.
3. Copy the zip file to `/Tools/tg3040/FN Editor.pak.zip`.
4. Extract the zip in place, then delete the zip file.
5. Confirm that there is a `/Tools/tg3040/FN Editor.pak/launch.sh` file on your SD card.
6. Unmount your SD Card and insert it into your TrimUI Brick.
5 changes: 5 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "FN Editor",
"launch": "launch.sh",
"description": "Function Key Editor"
}

0 comments on commit 95cf951

Please sign in to comment.