forked from kn0wmad/startOS-simplexMQ-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (64 loc) · 2.44 KB
/
build-simplex-server.yml
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
name: Build and Publish SimpleX Docker Image
on:
workflow_dispatch:
inputs:
simplex_version:
description: 'SimpleX Server version to build (e.g. v6.0.4 or v6.1.0-beta.1). Use "latest" to build the most recent version'
required: true
default: 'latest'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
env:
REPO_URL: https://github.com/simplex-chat/simplex-chat.git
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch latest tags from SimpleX repository
run: |
git clone --depth=1 --tags $REPO_URL
cd simplex-chat
# Find the latest tag, filtering out any non-version tags like 'v*'
LATEST_TAG=$(git tag -l --sort=-v:refname 'v*' | head -n 1)
echo "Latest tag found: $LATEST_TAG"
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
- name: Determine version to build
run: |
if [ "${{ github.event.inputs.simplex_version }}" == "latest" ]; then
echo "Using latest tag: $LATEST_TAG"
echo "SIMPLEX_VERSION=$LATEST_TAG" >> $GITHUB_ENV
else
echo "Using specified version: ${{ github.event.inputs.simplex_version }}"
echo "SIMPLEX_VERSION=${{ github.event.inputs.simplex_version }}" >> $GITHUB_ENV
fi
- name: Build and push Docker image for x86 and arm
run: |
echo "Building SimpleX version: $SIMPLEX_VERSION"
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
docker buildx build \
--platform linux/amd64,linux/arm64 \
--file .github/Dockerfile.simplex \
--tag ghcr.io/${REPO_NAME}:$SIMPLEX_VERSION \
--build-arg SIMPLEX_VERSION=$SIMPLEX_VERSION \
--push \
.
- name: Image build complete
run: echo "Docker image has been built and published."