-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (74 loc) · 2.42 KB
/
mobileplanner.yml
File metadata and controls
92 lines (74 loc) · 2.42 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
name: Build MobilePlanner Image
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
env:
REGISTRY: ghcr.io
OWNER: collaborativeroboticslab
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-mobileplanner-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
lfs: true
- name: Derive MobilePlanner tag
id: version
shell: bash
run: |
set -euo pipefail
sanitize_tag() {
local value="$1"
value="${value%.exe}"
value="${value// /-}"
value="$(printf '%s' "$value" | tr '[:upper:]' '[:lower:]')"
value="$(printf '%s' "$value" | sed -E 's/[^a-z0-9._-]+/-/g; s/^-+//; s/-+$//; s/-+/-/g')"
printf '%s' "$value"
}
mobile_file="$(find exe -maxdepth 1 -type f -iname 'MobilePlanner*.exe' | sort | head -n 1 || true)"
mobile_tag="latest"
if [[ -n "$mobile_file" ]]; then
mobile_tag="$(sanitize_tag "$(basename "$mobile_file")")"
fi
echo "mobile_tag=$mobile_tag" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.OWNER }}/omron_win_software-mobileplanner
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha
type=raw,value=${{ steps.version.outputs.mobile_tag }}
- name: Build and Push MobilePlanner Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.mobileplanner
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}