Skip to content

Offline gym log for Android. No account, no ads, no internet.

Add self-host release workflow

InlitXc999c0c1a4c9
diff --git a/.github/workflows/selfhost.yml b/.github/workflows/selfhost.yml
new file mode 100644
index 0000000..4eb5c0f
--- /dev/null
+++ b/.github/workflows/selfhost.yml
@@ -0,0 +1,134 @@
+name: Self-host
+
+on:
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: 'Release tag to attach the files to, e.g. v2.2.0'
+ required: true
+ type: string
+
+permissions:
+ contents: write
+ packages: write
+
+env:
+ FLUTTER_VERSION: '3.41.9'
+ DART_VERSION: '3.11.5'
+
+jobs:
+ web:
+ name: Web app
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.tag }}
+
+ - uses: subosito/flutter-action@v2
+ with:
+ channel: stable
+ flutter-version: ${{ env.FLUTTER_VERSION }}
+ cache: true
+
+ - run: flutter pub get
+
+ - run: flutter build web --wasm --release --no-web-resources-cdn --pwa-strategy=none
+
+ - uses: actions/upload-artifact@v4
+ with:
+ name: web
+ path: build/web
+
+ server:
+ name: Server (${{ matrix.name }})
+ needs: web
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ include:
+ - { os: ubuntu-latest, name: linux-x64, exe: gymmane-server }
+ - { os: ubuntu-24.04-arm, name: linux-arm64, exe: gymmane-server }
+ - { os: macos-latest, name: macos-arm64, exe: gymmane-server }
+ - { os: windows-latest, name: windows-x64, exe: gymmane-server.exe }
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.tag }}
+
+ - uses: dart-lang/setup-dart@v1
+ with:
+ sdk: ${{ env.DART_VERSION }}
+
+ - name: Build server
+ working-directory: server
+ run: |
+ dart pub get
+ dart test
+ dart compile exe bin/server.dart -o ${{ matrix.exe }}
+
+ - uses: actions/download-artifact@v4
+ with:
+ name: web
+ path: package/gymmane/web
+
+ - name: Package (Linux and macOS)
+ if: runner.os != 'Windows'
+ run: |
+ cp server/${{ matrix.exe }} package/gymmane/
+ chmod +x package/gymmane/${{ matrix.exe }}
+ tar -czf gymmane-selfhost-${{ matrix.name }}.tar.gz -C package gymmane
+
+ - name: Package (Windows)
+ if: runner.os == 'Windows'
+ shell: pwsh
+ run: |
+ Copy-Item server/${{ matrix.exe }} package/gymmane/
+ Set-Content -Path package/gymmane/start.bat -Value "@echo off`r`ncd /d %~dp0`r`ngymmane-server.exe`r`npause"
+ Compress-Archive -Path package/gymmane -DestinationPath gymmane-selfhost-${{ matrix.name }}.zip
+
+ - name: Attach to the release
+ shell: bash
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: gh release upload "${{ inputs.tag }}" gymmane-selfhost-${{ matrix.name }}.* --clobber --repo "${{ github.repository }}"
+
+ docker:
+ name: Docker image
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.tag }}
+
+ - uses: docker/setup-qemu-action@v3
+
+ - uses: docker/setup-buildx-action@v3
+
+ - uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ github.token }}
+
+ - name: Image name
+ id: name
+ run: |
+ echo "image=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/gymmane" >> "$GITHUB_OUTPUT"
+ echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
+ env:
+ TAG: ${{ inputs.tag }}
+
+ - uses: docker/build-push-action@v6
+ with:
+ context: .
+ platforms: linux/amd64,linux/arm64
+ push: true
+ build-args: FLUTTER_VERSION=${{ env.FLUTTER_VERSION }}
+ tags: |
+ ${{ steps.name.outputs.image }}:latest
+ ${{ steps.name.outputs.image }}:${{ steps.name.outputs.version }}
+ labels: |
+ org.opencontainers.image.source=https://github.com/${{ github.repository }}
+ org.opencontainers.image.description=GymMane self-hosted: the full app on your own server
+ org.opencontainers.image.licenses=GPL-3.0