Skip to content

widgets: diy: Fix missing cockpit- in auto-save setting #5112

widgets: diy: Fix missing cockpit- in auto-save setting

widgets: diy: Fix missing cockpit- in auto-save setting #5112

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
schedule:
# Run every 6 days to help us stay on our toes
- cron: '0 0 */6 * *'
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install system dependencies
run: |
sudo apt install -y xvfb
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.13.0'
- name: Install, lint, typecheck, and build
run: |
yarn install --frozen-lockfile --network-timeout 600000
yarn lint
yarn typecheck
yarn build
deploy-page:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.13.0'
- name: Install and build
run: |
yarn install --frozen-lockfile --network-timeout 600000
yarn build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.5
if: success() && github.event_name != 'pull_request'
with:
branch: gh-pages
folder: dist
deploy-electron:
needs: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-15-intel
suffix: mac
arch: x64
extension: dmg
latestMetadataName: latest-mac.yml
deployCommand: deploy:electron:mac:x64
- os: macos-15
suffix: mac
arch: arm64
extension: dmg
latestMetadataName: latest-mac-arm64.yml
deployCommand: deploy:electron:mac:arm64
- os: ubuntu-latest
suffix: linux
arch: x86_64
extension: AppImage
latestMetadataName: latest-linux.yml
deployCommand: deploy:electron
- os: ubuntu-24-arm
suffix: linux
arch: arm64
extension: AppImage
latestMetadataName: latest-linux-arm64.yml
deployCommand: deploy:electron
- os: windows-latest
suffix: win
arch: x64
extension: exe
latestMetadataName: latest.yml
deployCommand: deploy:electron:windows
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Install snapcraft for arm64
if: matrix.os == 'ubuntu-24-arm'
run: |
sudo apt update
sudo apt install -y --fix-missing snapd
for i in {1..10}; do
if sudo snap install snapcraft --classic; then
break
elif [ $i -eq 10 ]; then
exit 1
else
echo "Retry $i failed, waiting 30s..."
sleep 30
fi
done
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.13.0'
- name: Set version as environment variable (Windows)
if: matrix.os == 'windows-latest'
run: echo "VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')" >> $env:GITHUB_ENV
- name: Set version as environment variable (others)
if: matrix.os != 'windows-latest'
run: echo "VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')" >> $GITHUB_ENV
- name: Install and build
run: |
yarn install --frozen-lockfile --network-timeout 600000
yarn build
- name: Import Apple Certificate and Setup Keychain
if: (matrix.os == 'macos-15-intel' || matrix.os == 'macos-15') && github.event_name != 'pull_request'
env:
MAC_CERTIFICATE_BASE64: ${{ secrets.MAC_CERTIFICATE_BASE64 }}
MAC_CERTIFICATE_PWD: ${{ secrets.MAC_CERTIFICATE_PWD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
KEYCHAIN_NAME="build.keychain"
CERT_PATH="certificate.p12"
echo "Decoding certificate..."
echo "${MAC_CERTIFICATE_BASE64}" | base64 --decode > "${CERT_PATH}"
echo "Creating keychain ${KEYCHAIN_NAME}..."
security create-keychain -p "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_NAME}"
# Make the new keychain the default
security default-keychain -s "${KEYCHAIN_NAME}"
# Unlock the keychain
security unlock-keychain -p "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_NAME}"
echo "Importing certificate into ${KEYCHAIN_NAME}..."
# Import the certificate and allow codesign and productbuild to use it
security import "${CERT_PATH}" -k "${KEYCHAIN_NAME}" -P "${MAC_CERTIFICATE_PWD}" -T /usr/bin/codesign -T /usr/bin/productbuild
echo "Setting key partition list for the imported key to allow access in CI..."
security set-key-partition-list -S apple-tool:,apple: -s -k "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_NAME}"
rm "${CERT_PATH}"
# Make keychain name available to electron-builder
echo "CSC_KEYCHAIN_NAME=${KEYCHAIN_NAME}" >> $GITHUB_ENV
- name: Deploy (arm)
if: matrix.os == 'ubuntu-24-arm'
run: |
SNAPCRAFT_BUILD_ENVIRONMENT="host" yarn ${{ matrix.deployCommand }}
- name: Deploy (macOS - Release Build)
if: (matrix.os == 'macos-15-intel' || matrix.os == 'macos-15') && github.event_name != 'pull_request'
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# CSC_KEYCHAIN_NAME is set by the 'Import Apple Certificate...' step
run: |
echo "INFO: Building macOS for Release (non-PR). Signing and notarization will be attempted."
yarn ${{ matrix.deployCommand }}
- name: Deploy (macOS - PR Build)
if: (matrix.os == 'macos-15-intel' || matrix.os == 'macos-15') && github.event_name == 'pull_request'
# No Apple ID env vars here, and 'Import Apple Certificate...' step was skipped, so no CSC_KEYCHAIN_NAME
run: |
echo "INFO: Building macOS for Pull Request. Signing and notarization will be skipped."
yarn ${{ matrix.deployCommand }}:pr
- name: Deploy (Windows / Linux non-arm)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest'
# No Apple specific env vars needed here as electron-builder ignores them on these platforms
run: |
yarn ${{ matrix.deployCommand }}
- name: Rename macOS arm64 latest metadata
if: matrix.os == 'macos-15'
run: |
# In some environments the file may already be generated with the arm64 suffix.
# Only rename if the generic name exists.
if [ -f dist/latest-mac.yml ]; then mv dist/latest-mac.yml dist/latest-mac-arm64.yml; fi
- name: Package AppImage in tar.gz (Linux)
if: matrix.suffix == 'linux'
run: |
cd dist
chmod +x Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.AppImage
tar -czvf Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.AppImage.tar.gz \
Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.AppImage
- name: Upload binary artifact
if: matrix.suffix != 'linux'
uses: actions/upload-artifact@v4
with:
name: Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.${{ matrix.extension }}
path: dist/Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.${{ matrix.extension }}
if-no-files-found: error
- name: Upload binary release
uses: svenstaro/upload-release-action@v2
if: matrix.suffix != 'linux' && startsWith(github.ref, 'refs/tags/') && success()
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.${{ matrix.extension }}
tag: ${{ github.ref }}
overwrite: true
prerelease: true
file_glob: true
- name: Upload tar.gz artifact (Linux)
if: matrix.suffix == 'linux'
uses: actions/upload-artifact@v4
with:
name: Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.AppImage.tar.gz
path: dist/Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.AppImage.tar.gz
if-no-files-found: error
- name: Upload tar.gz release (Linux)
uses: svenstaro/upload-release-action@v2
if: matrix.suffix == 'linux' && startsWith(github.ref, 'refs/tags/') && success()
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.AppImage.tar.gz
tag: ${{ github.ref }}
overwrite: true
prerelease: true
- name: Upload diff release (mac-only)
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/') && success() && (matrix.os == 'macos-15-intel' || matrix.os == 'macos-15')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.zip
tag: ${{ github.ref }}
overwrite: true
prerelease: true
file_glob: true
- name: Upload latest metadata release
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/') && success()
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/${{ matrix.latestMetadataName }}
tag: ${{ github.ref }}
overwrite: true
prerelease: true
file_glob: true
deploy-flatpak:
needs: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
suffix: linux
arch: x86_64
extension: flatpak
- os: ubuntu-24-arm
suffix: linux
arch: arm64
extension: flatpak
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.13.0'
- name: Install flatpak
run: |
sudo apt update
sudo apt install -y --fix-missing flatpak flatpak-builder
sudo flatpak remote-add --system flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --user flathub https://flathub.org/repo/flathub.flatpakrepo || true
- name: Set version as environment variable (others)
run: echo "VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')" >> $GITHUB_ENV
- name: Build electron (arm)
if: matrix.os == 'ubuntu-24-arm'
run: |
yarn install --frozen-lockfile --network-timeout 600000
yarn build
env DEBUG="@malept/flatpak-bundler" yarn deploy:flatpak --arm64
- name: Build electron (x86_64)
if: matrix.os == 'ubuntu-latest'
run: |
yarn install --frozen-lockfile --network-timeout 600000
yarn build
env DEBUG="@malept/flatpak-bundler" yarn deploy:flatpak --x64
- name: Rename 'aarch64' to 'arm64'
if: matrix.os == 'ubuntu-24-arm'
run: |
mv dist/Cockpit-${{ matrix.suffix }}-aarch64-${{ env.VERSION }}.${{ matrix.extension }} dist/Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.${{ matrix.extension }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.${{ matrix.extension }}
path: dist/Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.${{ matrix.extension }}
if-no-files-found: error
- name: Upload Release
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/') && success()
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/Cockpit-${{ matrix.suffix }}-${{ matrix.arch }}-${{ env.VERSION }}.${{ matrix.extension }}
tag: ${{ github.ref }}
overwrite: true
prerelease: true
file_glob: true
deploy-blueos-extension:
needs: test
runs-on: ubuntu-latest
env:
PLATFORMS: "linux/arm/v7,linux/arm64/v8,linux/amd64"
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
steps:
- name: Login to Docker Hub
if: success() && github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.13.0'
- name: Build cockpit
run: |
yarn install --frozen-lockfile --network-timeout 600000
yarn build
- name: Prepare
id: prepare
run: |
# Deploy image with the name of the branch, if the build is a git tag, replace tag with the tag name.
# If git tag matches semver, append latest tag to the push.
DOCKER_IMAGE=${DOCKER_USERNAME:-bluerobotics}/cockpit
VERSION=${GITHUB_REF##*/}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
fi
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest"
fi
echo "docker_image=${DOCKER_IMAGE}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "buildx_args=${TAGS} --file Dockerfile ." >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Docker Buildx (build)
run: |
docker buildx build \
--output "type=image,push=false" \
--platform $PLATFORMS \
${{ steps.prepare.outputs.buildx_args }}
- name: Docker Buildx (push)
if: success() && github.event_name != 'pull_request'
run: |
docker buildx build \
--output "type=image,push=true" \
--platform $PLATFORMS \
${{ steps.prepare.outputs.buildx_args }}
- name: Inspect image
if: always() && github.event_name != 'pull_request'
run: |
docker buildx imagetools \
inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}