From b609ebafe1149544a3fb940b83b4f3a9dc33daff Mon Sep 17 00:00:00 2001 From: August Date: Sun, 8 Nov 2026 19:57:28 +0000 Subject: [PATCH] Add release workflow --- .gitea/workflows/ci.yaml | 1 + .gitea/workflows/release.yaml | 31 +++++++++++++++++++++++ build.sh | 47 ++++++++++++++++++++++++----------- 3 files changed, 65 insertions(+), 14 deletions(-) create mode 100644 .gitea/workflows/release.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index b48aedd..34558c9 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -18,3 +18,4 @@ jobs: - uses: actions/checkout@v4 - run: python3 -m pip install platformio - run: ${{ gitea.workspace }}/build.sh ${{ gitea.workspace }}/Configs/FLSUN/Kossel/MakerBase\ MKS\ Gen\ L/printer.env + diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..a78b3d8 --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,31 @@ +name: Release Asset + +on: + push: + tags: + - "*" + +jobs: + creality-ender-3-pro-release: + name: Creality Ender 3 Pro - Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: python3 -m pip install platformio + - run: ${{ gitea.workspace }}/build.sh ${{ gitea.workspace }}/Configs/Creality/Ender-3\ Pro/BigTreeTech\ SKR\ Mini\ E3\ 3.0/printer.env + - uses: akkuman/gitea-release-action@v1 + with: + files: |- + output/** + + flsun-kossel-release: + name: FLSUN Kossel - Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: python3 -m pip install platformio + - run: ${{ gitea.workspace }}/build.sh ${{ gitea.workspace }}/Configs/FLSUN/Kossel/MakerBase\ MKS\ Gen\ L/printer.env + - uses: akkuman/gitea-release-action@v1 + with: + files: |- + output/** \ No newline at end of file diff --git a/build.sh b/build.sh index f94c250..5b8af41 100755 --- a/build.sh +++ b/build.sh @@ -2,10 +2,10 @@ set -ueo pipefail -if (( $# != 1 )); then +if (( $# < 1 )); then echo "Invalid CLI args." echo "Usage:" - echo "./build.sh path/to/printer.env" + echo "./build.sh path/to/printer.env [-c]" exit 1 fi @@ -15,33 +15,52 @@ if ! [ -f "$1" ]; then exit 1 fi +if (( $# == 2 )); then + if [ $2 == "-c" ]; then + echo "Check mode- will not compile a binary!!!" + export TEST_MODE=1 + fi +else + export TEST_MODE=0 +fi + echo "Printer env file found: $1" echo -n "Loading config variables... " source "$1" echo "OK" -filename="fw-${name// /_}-${board// /_}-ver$config_version.$fw_ext" -echo "Artifact name will be: ""$filename""" +if (( $TEST_MODE == 0 )); then + filename="fw-${name// /_}-${board// /_}-ver$config_version.$fw_ext" + echo "Artifact name will be: ""$filename""" +fi if ! [ -d Marlin ]; then git clone https://github.com/MarlinFirmware/Marlin --depth 1 - cd Marlin else cd Marlin - git pull + git fetch --all + git reset --hard origin/bugfix-2.1.x + cd .. fi echo -n "Copying custom config files... " -cp "$(dirname "$1")"/*.h Marlin/ +cp "$(dirname "$1")"/*.h Marlin/Marlin/ echo "OK" -echo "Running PlatformIO build!" -pio run -e "$pio_env" -echo -n "Finished building. Copying firmware."$fw_ext"... " -mkdir -p ../output -cp .pio/build/"$pio_env"/firmware.$fw_ext ../output/"$filename" -echo "OK" -cd .. +cd Marlin +if (( $TEST_MODE == 0 )); then + echo "Running PlatformIO build!" + pio run -e "$pio_env" + echo -n "Finished building. Copying firmware."$fw_ext"... " + mkdir -p ../output + cp .pio/build/"$pio_env"/firmware.$fw_ext ../output/"$filename" + echo "OK" +else + echo "Running PlatformIO checks!" + pio check -e "$pio_env" + echo -n "Finished checks." +fi +cd ../../