Testing build of Podman Desktop from Main branch #403
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Copyright (C) 2024 Red Hat, Inc. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # | |
| # SPDX-License-Identifier: Apache-2.0 | |
| name: Daily testing build | |
| run-name: Testing build of Podman Desktop from Main branch | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 1 * * *' | |
| env: | |
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| DEBUG: electron-builder | |
| permissions: | |
| contents: read | |
| jobs: | |
| tag: | |
| name: Tagging | |
| runs-on: ubuntu-24.04 | |
| # do not run on forks | |
| if: github.event.repository.fork == false | |
| outputs: | |
| githubTag: ${{ steps.TAG_UTIL.outputs.githubTag }} | |
| desktopVersion: ${{ steps.TAG_UTIL.outputs.desktopVersion }} | |
| releaseId: ${{ steps.create_release.outputs.id }} | |
| steps: | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| with: | |
| token: ${{ secrets.PODMAN_DESKTOP_BOT_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Generate tag utilities | |
| id: TAG_UTIL | |
| run: | | |
| CURRENT_DAY=$(date +'%Y%m%d') | |
| SHORT_SHA1=$(git rev-parse --short HEAD) | |
| # grab the version from the package.json | |
| PODMAN_DEKSTOP_VERSION=$(jq -r '.version' package.json) | |
| # remove the -next from the version | |
| STRIPPED_VERSION=${PODMAN_DEKSTOP_VERSION%-next} | |
| TAG_PATTERN=${STRIPPED_VERSION}-$(date +'%Y%m%d%H%M')-${SHORT_SHA1} | |
| echo "githubTag=v$TAG_PATTERN" >> ${GITHUB_OUTPUT} | |
| echo "desktopVersion=$TAG_PATTERN" >> ${GITHUB_OUTPUT} | |
| # check for tag existence - exit the workflow | |
| echo "Checking if tag exists: $(git rev-parse -q --verify "$githubTag")" | |
| if [ git rev-parse -q --verify "$githubTag" ]; then | |
| echo "Tag '$githubTag' exists, skipping..." | |
| exit 1; | |
| else | |
| echo "Tag '$githubTag' does not exist yet, continue" | |
| fi | |
| - name: Create a Tag, commit and push to testing-prereleases | |
| run: | | |
| # quite heavy solution, we might only consider crating a tag, but not actually pushing whole state of the repo | |
| echo "Setting github.actor: ${{ github.actor }} and id: ${{ github.actor_id }}" | |
| git config --local user.name ${{ github.actor }} | |
| git config --local user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" | |
| sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ steps.TAG_UTIL.outputs.desktopVersion }}\",#g" package.json | |
| find extensions/* -maxdepth 2 -name "package.json" | xargs -I {} sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ steps.TAG_UTIL.outputs.desktopVersion }}\",#g" {} | |
| # change the repository field to be the prerelease repository in package.json file | |
| sed -i "s#\"repository\":\ \"\(.*\)\",#\"repository\":\ \"https://github.com/podman-desktop/testing-prereleases\",#g" package.json | |
| cat package.json | |
| git add package.json extensions/*/package.json | |
| # get rid of .github/workflows - requires additional permissions | |
| rm -rf .github/workflows/* | |
| git add .github/ | |
| git commit -m "chore: tag ${{ steps.TAG_UTIL.outputs.githubTag }}" | |
| echo "Tagging with ${{ steps.TAG_UTIL.outputs.githubTag }}" | |
| git tag ${{ steps.TAG_UTIL.outputs.githubTag }} | |
| # push tag to the prereleases repository | |
| git remote add prereleases https://github.com/podman-desktop/testing-prereleases | |
| git push prereleases ${{ steps.TAG_UTIL.outputs.githubTag }} | |
| - name: Create Release | |
| id: create_release | |
| uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0 | |
| with: | |
| tag: ${{ steps.TAG_UTIL.outputs.githubTag }} | |
| name: ${{ steps.TAG_UTIL.outputs.githubTag }} | |
| draft: true | |
| prerelease: true | |
| owner: podman-desktop | |
| repo: testing-prereleases | |
| token: ${{ secrets.PODMAN_DESKTOP_BOT_TOKEN }} | |
| build: | |
| name: Build / ${{ matrix.os }} | |
| needs: tag | |
| runs-on: ${{ matrix.os }} | |
| # do not run on forks | |
| if: github.event.repository.fork == false | |
| env: | |
| ELECTRON_ENABLE_INSPECT: true | |
| GITHUB_TOKEN: ${{ secrets.PODMAN_DESKTOP_BOT_TOKEN }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| os: [ubuntu-24.04, windows-2025, macos-15] | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| with: | |
| repository: podman-desktop/testing-prereleases | |
| ref: ${{ needs.tag.outputs.githubTag }} | |
| - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 | |
| name: Install pnpm | |
| with: | |
| run_install: false | |
| - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: 22 | |
| cache: 'pnpm' | |
| - name: Execute pnpm | |
| run: pnpm install | |
| - name: Install Flatpak dependencies | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install flatpak -y | |
| sudo apt-get install flatpak-builder -y | |
| sudo apt-get install elfutils -y | |
| flatpak remote-add --if-not-exists flathub --user https://flathub.org/repo/flathub.flatpakrepo | |
| flatpak install flathub --no-static-deltas --user -y org.freedesktop.Platform//25.08 org.freedesktop.Sdk//25.08 | |
| - name: Run Build and Compile on all platforms | |
| timeout-minutes: 60 | |
| run: pnpm compile:next | |
| release: | |
| needs: [tag, build] | |
| name: Release | |
| runs-on: ubuntu-24.04 | |
| # do not run on forks and once all the builds are completed (no matter the status) | |
| if: github.event.repository.fork == false && always() | |
| steps: | |
| - name: id | |
| run: | | |
| echo the release id is ${{ needs.tag.outputs.releaseId }} | |
| echo "The result of the build jobs: ${{ needs.build.result }}" | |
| - name: Publish release | |
| if: ${{ needs.build.result == 'success' }} | |
| uses: StuYarrow/publish-release@01f2a1365bacd77bad861873a7fdf274ab49eefd # v1.1.2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PODMAN_DESKTOP_BOT_TOKEN }} | |
| with: | |
| id: ${{ needs.tag.outputs.releaseId }} | |
| repo: testing-prereleases | |
| owner: podman-desktop | |
| - name: Delete release | |
| if: ${{ needs.build.result != 'success' }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PODMAN_DESKTOP_BOT_TOKEN }} | |
| run: | | |
| echo "Build failed, deleting release with id: ${{ needs.tag.outputs.releaseId }}" | |
| set -e | |
| curl -L -f -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| "https://api.github.com/repos/podman-desktop/testing-prereleases/releases/${{ needs.tag.outputs.releaseId }}" | |
| echo "Release deleted..." | |
| echo "Delete tag: ${{ needs.tag.outputs.githubTag }}" | |
| curl -L -f -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| "https://api.github.com/repos/podman-desktop/testing-prereleases/git/refs/tags/${{ needs.tag.outputs.githubTag }}" | |
| echo "Tag deleted..." |