diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2174377 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +--- +name: Create Release +on: + push: + branches: + - main + paths: + - 'manwhere' + - '.github/workflows/release.yml' + +jobs: + release: + runs-on: self-hosted + steps: + - name: Get version from commit + id: version + run: | + VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "v0.1.0-$(git rev-parse --short HEAD)") + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Version: $VERSION" + + - name: Create Release + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + VERSION="${{ steps.version.outputs.version }}" + + # Delete existing release with same tag if exists + curl -s -X DELETE \ + -H "Authorization: token $GITEA_TOKEN" \ + "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/tags/$VERSION" || true + + # Create new release + curl -s -X POST \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{ + \"tag_name\": \"$VERSION\", + \"name\": \"manwhere $VERSION\", + \"body\": \"Release of manwhere binary\\n\\nBuilt from commit: ${{ github.sha }}\", + \"target_commitish\": \"main\" + }" \ + "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" | tee release.json + + RELEASE_ID=$(jq -r '.id' release.json) + + # Upload binary + curl -s -X POST \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/octet-stream" \ + --data-binary @manwhere \ + "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/$RELEASE_ID/assets?name=manwhere&attachment=true" + + echo "Release created: ${{ github.server_url }}/${{ github.repository }}/releases/tag/$VERSION" diff --git a/.gitignore b/.gitignore index 2d72bff..b26e12f 100755 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ poertry # Zig build artifacts .zig-cache/ -.zig-out/ +zig-out/ # Other build artifacts *.o diff --git a/scripts/manwhere/.local/bin/manwhere b/scripts/manwhere/.local/bin/manwhere deleted file mode 100755 index 5f02c1d..0000000 Binary files a/scripts/manwhere/.local/bin/manwhere and /dev/null differ