Skip to content

Commit 6ae6d88

Browse files
authored
improve release workflow (#1528)
1 parent bedb40c commit 6ae6d88

File tree

2 files changed

+144
-20
lines changed

2 files changed

+144
-20
lines changed

.github/release.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
changelog:
2+
categories:
3+
- title: 🏕 Features
4+
labels:
5+
- '*'
6+
exclude:
7+
labels:
8+
- dependencies
9+
- title: 👒 Dependencies
10+
labels:
11+
- dependencies

.github/workflows/release.yml

Lines changed: 133 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,143 @@
1-
name: Release
1+
name: Release Open VSX
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
tags:
6+
- "v*"
67

78
env:
8-
SERVER_TAG: ghcr.io/eclipse/openvsx-server
9-
WEBUI_TAG: ghcr.io/eclipse/openvsx-webui
9+
REGISTRY: ghcr.io
10+
SERVER_IMAGE: openvsx-server
11+
WEBUI_IMAGE: openvsx-webui
1012

1113
jobs:
12-
build:
14+
prepare:
15+
if: github.repository == 'eclipse/openvsx'
16+
runs-on: ubuntu-22.04
17+
outputs:
18+
release-tag: ${{ steps.context.outputs.RELEASE_TAG }}
19+
release-version: ${{ steps.context.outputs.RELEASE_VERSION }}
20+
steps:
21+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
22+
with:
23+
persist-credentials: false
24+
fetch-depth: 0
25+
- name: "Setup context"
26+
id: context
27+
shell: bash
28+
env:
29+
REF: ${{ github.ref }}
30+
REF_NAME: ${{ github.ref_name }}
31+
run: |
32+
echo "RELEASE_TAG=${REF_NAME}" >> $GITHUB_OUTPUT
33+
VERSION=$(echo ${REF_NAME} | sed 's/v//')
34+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_OUTPUT
35+
36+
build-and-push-webui:
37+
permissions:
38+
contents: read
39+
packages: write
40+
id-token: write
41+
runs-on: ubuntu-22.04
42+
steps:
43+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
44+
with:
45+
persist-credentials: false
46+
47+
- name: Log in to the Container registry
48+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
49+
with:
50+
registry: ${{ env.REGISTRY }}
51+
username: ${{ github.actor }}
52+
password: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Extract metadata (tags, labels) for Docker
55+
id: meta
56+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
57+
with:
58+
images: |
59+
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.WEBUI_IMAGE }}
60+
tags:
61+
type=ref,event=tag
62+
labels: |
63+
org.opencontainers.image.title=OpenVSX WebUI
64+
65+
- name: Build and push Web UI Image
66+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
67+
with:
68+
context: webui
69+
push: true
70+
tags: ${{ steps.meta.outputs.tags }}
71+
labels: ${{ steps.meta.outputs.labels }}
72+
73+
build-and-push-server:
1374
permissions:
14-
contents: none
15-
runs-on: ubuntu-latest
75+
contents: read
76+
packages: write
77+
id-token: write
78+
runs-on: ubuntu-22.04
1679
steps:
17-
- uses: actions/checkout@v6
18-
- name: Set Image Version
19-
run: echo "IMAGE_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
20-
- name: Build Web UI Image
21-
run: docker build -t $WEBUI_TAG:$IMAGE_VERSION webui
22-
- name: Build Server Image
23-
run: docker build -t $SERVER_TAG:$IMAGE_VERSION server --secret id=dv-key,env=DEVELOCITY_ACCESS_KEY
80+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
81+
with:
82+
persist-credentials: false
83+
84+
- name: Set up JDK
85+
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
86+
with:
87+
distribution: 'temurin'
88+
java-version: 25
89+
90+
- name: Run Server Tests
91+
run: server/gradlew --no-daemon -p server check
2492
env:
2593
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_API_TOKEN }}
26-
- name: Push Docker Images
27-
run: |
28-
echo ${{ secrets.BOT_ACCESS_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
29-
docker push $SERVER_TAG:$IMAGE_VERSION
30-
docker push $WEBUI_TAG:$IMAGE_VERSION
94+
95+
- name: Log in to the Container registry
96+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
97+
with:
98+
registry: ${{ env.REGISTRY }}
99+
username: ${{ github.actor }}
100+
password: ${{ secrets.GITHUB_TOKEN }}
101+
102+
- name: Extract metadata (tags, labels) for Docker
103+
id: meta
104+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
105+
with:
106+
images: |
107+
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.SERVER_IMAGE }}
108+
tags:
109+
type=ref,event=tag
110+
labels: |
111+
org.opencontainers.image.title=OpenVSX Server
112+
113+
- name: Build and push Server Image
114+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
115+
env:
116+
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_API_TOKEN }}
117+
with:
118+
context: server
119+
push: true
120+
tags: ${{ steps.meta.outputs.tags }}
121+
labels: ${{ steps.meta.outputs.labels }}
122+
secret-envs: |
123+
"dv-key=DEVELOCITY_ACCESS_KEY"
124+
125+
github-publish:
126+
runs-on: ubuntu-22.04
127+
needs: ['prepare', 'build-and-push-webui', 'build-and-push-server']
128+
permissions:
129+
contents: write
130+
steps:
131+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
132+
with:
133+
persist-credentials: false
134+
135+
- name: "Create GitHub release"
136+
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
137+
with:
138+
name: "v${{ needs.prepare.outputs.release-version }}"
139+
tag_name: "${{ needs.prepare.outputs.release-tag }}"
140+
draft: false
141+
prerelease: false
142+
generate_release_notes: true
143+
make_latest: true

0 commit comments

Comments
 (0)