From c6cb92d21c5b042dad0b4a3e133eaea4bfd2bd47 Mon Sep 17 00:00:00 2001
From: Julien Dessaux <julien.dessaux@adyxax.org>
Date: Thu, 13 Mar 2025 00:51:30 +0100
Subject: [PATCH] chore(tooling): add build and release actions workflow steps

---
 .forgejo/workflows/main.yaml | 60 ++++++++++++++++++++++++++++++------
 1 file changed, 51 insertions(+), 9 deletions(-)

diff --git a/.forgejo/workflows/main.yaml b/.forgejo/workflows/main.yaml
index ca34650..dbda6fb 100644
--- a/.forgejo/workflows/main.yaml
+++ b/.forgejo/workflows/main.yaml
@@ -4,21 +4,63 @@ on:
   workflow_dispatch:
 
 jobs:
-  fmt:
+  #fmt:
+  #  runs-on: 'self-hosted'
+  #  steps:
+  #    - uses: 'actions/checkout@v4'
+  #    - uses: 'actions/setup-go@v5'
+  #      with:
+  #        go-version-file: 'go.mod'
+  #    - run: |
+  #        make tidy no-dirty
+  #test:
+  #  runs-on: 'self-hosted'
+  #  steps:
+  #    - uses: 'actions/checkout@v4'
+  #    - uses: 'actions/setup-go@v5'
+  #      with:
+  #        go-version-file: 'go.mod'
+  #    - run: |
+  #        make check tidy no-dirty
+  build:
+    #if: "${{ startsWith(github.ref, 'refs/tags/') }}"
+    #needs:
+    #  - 'fmt'
+    #  - 'test'
     runs-on: 'self-hosted'
     steps:
       - uses: 'actions/checkout@v4'
       - uses: 'actions/setup-go@v5'
         with:
           go-version-file: 'go.mod'
-      - run: |
-          make tidy no-dirty
-  test:
+      - name: 'build'
+        run: |
+          printf '%s' "$GIT_CRYPT_SECRET" | base64 -d > secret
+          git-crypt unlock secret
+          make build
+        env:
+          GIT_CRYPT_SECRET: '${{ secrets.GIT_CRYPT }}'
+      - uses: 'actions/upload-artifact@v3'
+        with:
+          if-no-files-found: 'error'
+          name: 'ods'
+          path: 'ods'
+  publish:
+    needs:
+      - 'build'
     runs-on: 'self-hosted'
     steps:
-      - uses: 'actions/checkout@v4'
-      - uses: 'actions/setup-go@v5'
+      - uses: 'actions/download-artifact@v3'
         with:
-          go-version-file: 'go.mod'
-      - run: |
-          make check tidy no-dirty
+          name: 'ods'
+      - uses: 'actions/forgejo-release@v2'
+        with:
+          url: 'https://git.adyxax.org/'
+          repo: 'adyxax/ods'
+          direction: 'upload'
+          tag: '${{ github.ref_name }}'
+          sha: '${{ github.sha }}'
+          release-dir: './'
+          token: '${{ secrets.TOKEN }}'
+          hide-archive-link: true
+          release-notes-assistant: true