From 01dbf9094e9b605f8af74d8721a4e4f832c9ecd8 Mon Sep 17 00:00:00 2001 From: Vitalii Koshura Date: Thu, 13 Feb 2025 01:29:16 +0100 Subject: [PATCH] [ci] upload snap to snapstore Signed-off-by: Vitalii Koshura --- .github/workflows/snap.yml | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index 4627675a6d..54959643f9 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -1,6 +1,6 @@ # This file is part of BOINC. -# http://boinc.berkeley.edu -# Copyright (C) 2023 University of California +# https://boinc.berkeley.edu +# Copyright (C) 2025 University of California # # BOINC is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License @@ -18,12 +18,12 @@ name: Snap on: push: - branches: [ master, 'client_release/**' ] + branches: [ master ] tags: [ 'client_release/**' ] pull_request: branches: [ master ] schedule: - - cron: '0 0 * * *' + - cron: '0 0 * * *' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -64,6 +64,16 @@ jobs: run: | echo "VCPKG_BINARY_SOURCES=clear;x-aws-config,no-sign-request;x-aws,s3://vcpkg.cache.boinc/,read" >> $GITHUB_ENV + - name: Fix version in the snapcraft.yaml + run: | + PKG_VERSION=$(cat version.h | grep BOINC_VERSION_STRING | sed -e 's|#define BOINC_VERSION_STRING||' | jq -r .) + if [[ "x${PKG_VERSION}" == "x" ]]; then + printf "Could not obtain release package version from version.h" + exit 1 + fi + PKG_VERSION_FULL="${PKG_VERSION}-${{ github.run_number }}" + sed -i -E "s/(version: \"$PKG_VERSION\")/version: \"$PKG_VERSION_FULL\"/" ${{ github.workspace }}/snap/snapcraft.yaml + - name: Configure docker qemu if: success() uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 @@ -120,6 +130,24 @@ jobs: name: snap_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z + - name: Publish nightly snap build to the edge + if: success() && matrix.type == 'x64' && github.ref == 'refs/heads/master' && github.event_name == 'schedule' + uses: snapcore/action-publish@214b86e5ca036ead1668c79afb81e550e6c54d40 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_LOGIN }} + with: + snap: ${{ matrix.snap_file }} + release: edge + + - name: Publish alpha snap build to the beta + if: success() && matrix.type == 'x64' && startsWith(github.ref, 'refs/tags/') + uses: snapcore/action-publish@214b86e5ca036ead1668c79afb81e550e6c54d40 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_LOGIN }} + with: + snap: ${{ matrix.snap_file }} + release: beta + - name: Prepare artifacts for deploy if: success() run: python ./deploy/prepare_deployment.py linux_snap