Skip to content

Trusted publishing changes #4359

Trusted publishing changes

Trusted publishing changes #4359

Workflow file for this run

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/openvsx-server-snapshot:<sha or branch>`
# Tagging rules:
# - <sha> for pushes to main 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:
- main
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.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
- name: Test CLI
working-directory: cli
run: yarn test
build-and-push-webui:
permissions:
contents: read
packages: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Get all changed webui files
id: changed_webui_files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files: webui/**
- name: Log in to the Container registry
if: steps.changed_webui_files.outputs.any_changed == 'true'
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.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@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.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@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: webui
push: ${{ github.repository_owner == 'eclipse-openvsx' &&
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: 'temurin'
java-version: 25
- name: Get all changed server files
id: changed_server_files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
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@dbcb813823bdd20940b903addbd779551569679f # v4.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@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.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@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: server
push: ${{ github.repository_owner == 'eclipse-openvsx' &&
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 }}
analyse:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.x
- name: Install Yarn
working-directory: webui
run: |
corepack enable
corepack prepare yarn@stable --activate
yarn install --immutable
- name: Set up JDK
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: 'temurin'
java-version: 25
- name: Set up JBang
uses: jbangdev/setup-jbang@2b1b465a7b75f4222b81426f23a01e013aa7b95c # v0.1.1
- uses: j178/prek-action@4e14d07f9231acabce116ccfca13b13dd9755ece # v3.0.0