-
Notifications
You must be signed in to change notification settings - Fork 308
172 lines (151 loc) · 5.93 KB
/
main.yml
File metadata and controls
172 lines (151 loc) · 5.93 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
name: CI
# This workflow will test and build the different artifacts (cli, webui, server) when necessary
# and push built docker images as snapshot to ghcr.io on the following conditions:
# - in the upstream repo (not in a fork)
# - not triggered by dependabot
# - pushes to the master branch or pull_requests to the master branch not from forks
# The package can be accessed via `ghcr.io/eclipse/openvsx-server-snapshot:<sha or branch>`
# Tagging rules:
# - <sha> for pushes to master where <sha> corresponds to the commit hash
# - <branch_name> for pushes to pull request branches, will be overwritten with any subsequent push
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
branches:
- master
env:
REGISTRY: ghcr.io
SERVER_IMAGE: openvsx-server-snapshot
WEBUI_IMAGE: openvsx-webui-snapshot
jobs:
build-cli:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 24.x
- name: Install Yarn
working-directory: cli
run: |
corepack enable
corepack prepare yarn@stable --activate
- name: Build CLI
working-directory: cli
run: yarn
build-and-push-webui:
permissions:
contents: read
packages: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Get all changed webui files
id: changed_webui_files
uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1
with:
files: webui/**
- name: Log in to the Container registry
if: steps.changed_webui_files.outputs.any_changed == 'true'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
if: steps.changed_webui_files.outputs.any_changed == 'true'
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.WEBUI_IMAGE }}
tags: |
type=raw,value=${{ github.head_ref }},enable={{is_not_default_branch}}
type=raw,value={{sha}},enable={{is_default_branch}}
labels: |
org.opencontainers.image.title=OpenVSX WebUI Snapshot
- name: Build and push Web UI Image
if: steps.changed_webui_files.outputs.any_changed == 'true'
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: webui
push: ${{ github.repository_owner == 'eclipse' &&
github.actor != 'dependabot[bot]' &&
(
github.event_name == 'push' ||
(
contains(github.event.pull_request.labels.*.name, 'snapshot') &&
github.event.pull_request.head.repo.full_name == github.repository
)
) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-and-push-server:
permissions:
contents: read
packages: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: 'temurin'
java-version: 25
- name: Get all changed server files
id: changed_server_files
uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1
with:
files: server/**
- name: Run Server Tests
if: steps.changed_server_files.outputs.any_changed == 'true'
run: server/gradlew --no-daemon -p server check
- name: Log in to the Container registry
if: steps.changed_server_files.outputs.any_changed == 'true'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
if: steps.changed_server_files.outputs.any_changed == 'true'
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.SERVER_IMAGE }}
tags: |
type=raw,value=${{ github.head_ref }},enable={{is_not_default_branch}}
type=raw,value={{sha}},enable={{is_default_branch}}
labels: |
org.opencontainers.image.title=OpenVSX Server Snapshot
- name: Build and push Server Image
if: steps.changed_server_files.outputs.any_changed == 'true'
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: server
push: ${{ github.repository_owner == 'eclipse' &&
github.actor != 'dependabot[bot]' &&
(
github.event_name == 'push' ||
(
contains(github.event.pull_request.labels.*.name, 'snapshot') &&
github.event.pull_request.head.repo.full_name == github.repository
)
) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}