v0.0.1-rc5 #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Static Release | |
| on: | |
| release: | |
| types: [prereleased] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version (e.g., v3.0.0)' | |
| required: true | |
| jobs: | |
| build-static: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Get version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build static version | |
| run: bun run build:static -- --version=${{ steps.version.outputs.version }} | |
| - name: Create ZIP | |
| run: | | |
| cd dist | |
| zip -r ../exelearning-static-${{ steps.version.outputs.version }}.zip static/ | |
| - name: Upload to release | |
| if: github.event_name == 'release' | |
| run: | | |
| gh release upload ${{ steps.version.outputs.version }} \ | |
| exelearning-static-${{ steps.version.outputs.version }}.zip \ | |
| --clobber | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifact (for manual runs) | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: exelearning-static-${{ steps.version.outputs.version }} | |
| path: exelearning-static-*.zip | |
| # ============================================ | |
| # DOCKER IMAGE | |
| # ============================================ | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| if: github.repository == 'exelearning/exelearning' | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
| - name: Login to GHCR | |
| if: github.repository == 'exelearning/exelearning' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ${{ github.repository }} | |
| ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=ref,event=tag,suffix=-static | |
| type=raw,value=latest-static,enable=${{ !contains(steps.version.outputs.version, '-') }} | |
| - name: Remove .dockerignore | |
| run: rm -f .dockerignore | |
| - name: Build and push Docker image | |
| if: github.repository == 'exelearning/exelearning' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile.static | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64,linux/arm64 | |
| build-args: | | |
| VERSION=${{ steps.version.outputs.version }} | |
| cache-from: type=gha,scope=static | |
| cache-to: type=gha,mode=max,scope=static |