Skip to content

Build and Release

Build and Release #7

name: Build and Release
on:
# Manual trigger from Actions tab
workflow_dispatch:
inputs:
create_release:
description: "Create a GitHub Release with executables"
required: true
default: "true"
type: choice
options:
- "true"
- "false"
# Trigger on docker-launcher version tags
push:
tags:
- "docker-launcher-v*"
# Build Docker image
pull_request:
paths:
- "docker-launcher/**"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/esim-docker-launcher
jobs:
# Build Docker image and push to GitHub Container Registry
docker:
name: Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./docker-launcher
file: ./docker-launcher/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Build executables for Windows, Linux, macOS
executables:
name: Build ${{ matrix.os }}
needs: docker
if: >
startsWith(github.ref, 'refs/tags/docker-launcher-v') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true')
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
name: eSim-Launcher-Windows.exe
icon: docker-launcher/assets/esim_logo.ico
- os: ubuntu-latest
name: eSim-Launcher-Linux
icon: ""
- os: macos-latest
name: eSim-Launcher-macOS
icon: docker-launcher/assets/esim_logo.icns
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install pyinstaller
- name: Build with icon (Windows)
if: matrix.os == 'windows-latest'
run: pyinstaller --onefile --console --name eSim-Launcher --icon=${{ matrix.icon }} docker-launcher/run_esim_docker.py
- name: Build with icon (macOS)
if: matrix.os == 'macos-latest'
run: pyinstaller --onefile --console --name eSim-Launcher --icon=${{ matrix.icon }} docker-launcher/run_esim_docker.py
- name: Build (Linux)
if: matrix.os == 'ubuntu-latest'
run: pyinstaller --onefile --console --name eSim-Launcher docker-launcher/run_esim_docker.py
- name: Rename (Windows)
if: matrix.os == 'windows-latest'
run: Move-Item dist/eSim-Launcher.exe dist/${{ matrix.name }}
shell: pwsh
- name: Rename (Unix)
if: matrix.os != 'windows-latest'
run: |
mv dist/eSim-Launcher dist/${{ matrix.name }}
chmod +x dist/${{ matrix.name }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: dist/${{ matrix.name }}
# Create GitHub Release on tag push
release:
name: Release
needs: executables
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Determine version
id: version
run: |
if [[ "${{ github.ref }}" == refs/tags/docker-launcher-v* ]]; then
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "version=v$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT
fi
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.version }}
name: eSim Docker Launcher ${{ steps.version.outputs.version }}
body: |
## Downloads
| Platform | File |
|----------|------|
| Windows | eSim-Launcher-Windows.exe |
| Linux | eSim-Launcher-Linux |
| macOS | eSim-Launcher-macOS |
## Quick Start
1. Download the file for your OS
2. Run it (double-click or terminal)
3. Select "VNC Mode" from the menu
4. eSim opens in your browser!
Requires Docker Desktop.
files: |
artifacts/eSim-Launcher-Windows.exe/*
artifacts/eSim-Launcher-Linux/*
artifacts/eSim-Launcher-macOS/*