Skip to content

Commit 1e7963a

Browse files
authored
chore: add workflow to create testing-prelease testing builds (podman-desktop#10177)
* chore: add workflow to create testing-prelease testing builds Signed-off-by: Ondrej Dockal <[email protected]>
1 parent da88a89 commit 1e7963a

File tree

1 file changed

+161
-0
lines changed

1 file changed

+161
-0
lines changed
+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
#
2+
# Copyright (C) 2024 Red Hat, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# SPDX-License-Identifier: Apache-2.0
17+
18+
name: Daily testing build
19+
run-name: Testing build of Podman Desktop from Main branch
20+
21+
on:
22+
workflow_dispatch:
23+
schedule:
24+
- cron: '0 1 * * *'
25+
26+
env:
27+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
28+
DEBUG: electron-builder
29+
30+
jobs:
31+
tag:
32+
name: Tagging
33+
runs-on: ubuntu-24.04
34+
outputs:
35+
githubTag: ${{ steps.TAG_UTIL.outputs.githubTag }}
36+
desktopVersion: ${{ steps.TAG_UTIL.outputs.desktopVersion }}
37+
releaseId: ${{ steps.create_release.outputs.id }}
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
with:
42+
token: ${{ secrets.PODMAN_DESKTOP_BOT_TOKEN }}
43+
fetch-depth: 0
44+
45+
- name: Generate tag utilities
46+
id: TAG_UTIL
47+
run: |
48+
CURRENT_DAY=$(date +'%Y%m%d')
49+
SHORT_SHA1=$(git rev-parse --short HEAD)
50+
# grab the version from the package.json
51+
PODMAN_DEKSTOP_VERSION=$(jq -r '.version' package.json)
52+
# remove the -next from the version
53+
STRIPPED_VERSION=${PODMAN_DEKSTOP_VERSION%-next}
54+
TAG_PATTERN=${STRIPPED_VERSION}-$(date +'%Y%m%d%H%M')-${SHORT_SHA1}
55+
echo "githubTag=v$TAG_PATTERN" >> ${GITHUB_OUTPUT}
56+
echo "desktopVersion=$TAG_PATTERN" >> ${GITHUB_OUTPUT}
57+
# check for tag existence - exit the workflow
58+
echo "Checking if tag exists: $(git rev-parse -q --verify "$githubTag")"
59+
if [ git rev-parse -q --verify "$githubTag" ]; then
60+
echo "Tag '$githubTag' exists, skipping..."
61+
exit 1;
62+
else
63+
echo "Tag '$githubTag' does not exist yet, continue"
64+
fi
65+
66+
- name: Create a Tag, commit and push to testing-prereleases
67+
run: |
68+
# quite heavy solution, we might only consider crating a tag, but not actually pushing whole state of the repo
69+
echo "Setting github.actor: ${{ github.actor }} and id: ${{ github.actor_id }}"
70+
git config --local user.name ${{ github.actor }}
71+
git config --local user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
72+
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ steps.TAG_UTIL.outputs.desktopVersion }}\",#g" package.json
73+
find extensions/* -maxdepth 2 -name "package.json" | xargs -I {} sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ steps.TAG_UTIL.outputs.desktopVersion }}\",#g" {}
74+
# change the repository field to be the prerelease repository in package.json file
75+
sed -i "s#\"repository\":\ \"\(.*\)\",#\"repository\":\ \"https://github.com/podman-desktop/testing-prereleases\",#g" package.json
76+
cat package.json
77+
git add package.json extensions/*/package.json
78+
# get rid of .github/workflows - requires additional permissions
79+
rm -rf .github/workflows/*
80+
git add .github/
81+
git commit -m "chore: tag ${{ steps.TAG_UTIL.outputs.githubTag }}"
82+
echo "Tagging with ${{ steps.TAG_UTIL.outputs.githubTag }}"
83+
git tag ${{ steps.TAG_UTIL.outputs.githubTag }}
84+
# push tag to the prereleases repository
85+
git remote add prereleases https://github.com/podman-desktop/testing-prereleases
86+
git push prereleases ${{ steps.TAG_UTIL.outputs.githubTag }}
87+
88+
- name: Create Release
89+
id: create_release
90+
uses: ncipollo/release-action@v1
91+
with:
92+
tag: ${{ steps.TAG_UTIL.outputs.githubTag }}
93+
name: ${{ steps.TAG_UTIL.outputs.githubTag }}
94+
draft: true
95+
prerelease: true
96+
owner: podman-desktop
97+
repo: testing-prereleases
98+
token: ${{ secrets.PODMAN_DESKTOP_BOT_TOKEN }}
99+
100+
build:
101+
name: Build / ${{ matrix.os }}
102+
needs: tag
103+
runs-on: ${{ matrix.os }}
104+
env:
105+
ELECTRON_ENABLE_INSPECT: true
106+
GITHUB_TOKEN: ${{ secrets.PODMAN_DESKTOP_BOT_TOKEN }}
107+
strategy:
108+
fail-fast: false
109+
matrix:
110+
os: [ubuntu-24.04, windows-2022, macos-14]
111+
timeout-minutes: 60
112+
steps:
113+
- uses: actions/checkout@v4
114+
with:
115+
repository: podman-desktop/testing-prereleases
116+
ref: ${{ needs.tag.outputs.githubTag }}
117+
118+
- uses: pnpm/action-setup@v4
119+
name: Install pnpm
120+
with:
121+
run_install: false
122+
123+
- uses: actions/setup-node@v4
124+
with:
125+
node-version: 20
126+
cache: 'pnpm'
127+
128+
- name: Execute pnpm
129+
run: pnpm install
130+
131+
- name: Run Build on Ubuntu
132+
if: ${{ matrix.os == 'ubuntu-24.04' }}
133+
timeout-minutes: 40
134+
run: pnpm compile:next --linux tar.gz
135+
136+
- name: Run Build on Mac OS
137+
if: startsWith(matrix.os, 'macos')
138+
timeout-minutes: 40
139+
run: pnpm compile:next --mac dmg
140+
141+
- name: Run Build on Windows
142+
if: startsWith(matrix.os, 'windows')
143+
timeout-minutes: 40
144+
run: pnpm compile:next --win portable
145+
146+
release:
147+
needs: [tag, build]
148+
name: Release
149+
runs-on: ubuntu-24.04
150+
steps:
151+
- name: id
152+
run: echo the release id is ${{ needs.tag.outputs.releaseId }}
153+
154+
- name: Publish release
155+
uses: StuYarrow/[email protected]
156+
env:
157+
GITHUB_TOKEN: ${{ secrets.PODMAN_DESKTOP_BOT_TOKEN }}
158+
with:
159+
id: ${{ needs.tag.outputs.releaseId }}
160+
repo: testing-prereleases
161+
owner: podman-desktop

0 commit comments

Comments
 (0)