-
Notifications
You must be signed in to change notification settings - Fork 234
180 lines (152 loc) · 5.15 KB
/
docker-image.yml
File metadata and controls
180 lines (152 loc) · 5.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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/*