From 50ad7727cb43e7a6ab0a6ff13620faa7ac1f029f Mon Sep 17 00:00:00 2001 From: Andrew Starr-Bochicchio Date: Mon, 12 Aug 2024 17:03:28 -0400 Subject: [PATCH] snap: use snapcore/action-build for candidate builds (#1566) * snap: update to use core22 * snap: use snapcore/action-build to build --- .github/workflows/snapcraft-candidate.yml | 10 +--------- snap/snapcraft.yaml | 13 +++++++------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/snapcraft-candidate.yml b/.github/workflows/snapcraft-candidate.yml index 62355a1e1..be90545ac 100644 --- a/.github/workflows/snapcraft-candidate.yml +++ b/.github/workflows/snapcraft-candidate.yml @@ -16,17 +16,9 @@ jobs: # fetch-depth: 0 fetches all history for all branches and tags fetch-depth: 0 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build snap + uses: snapcore/action-build@v1 id: build - run: | - make _build_snap && \ - find doctl_v*.snap -exec echo "snap={}" >> "$GITHUB_OUTPUT" \; - uses: snapcore/action-publish@master env: diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 862f684e6..cea435b37 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -8,7 +8,7 @@ description: | clusters, firewalls, load balancers, database clusters, domains, and more. license: Apache-2.0 -base: core20 +base: core22 grade: stable confinement: strict @@ -24,22 +24,23 @@ parts: override-build: | cd $SNAPCRAFT_PART_BUILD chmod +x doctl-launch - snapcraftctl build + craftctl default + doctl: after: [launcher] - source: . + source: https://github.com/digitalocean/doctl + source-type: git plugin: go + build-snaps: [go/latest/stable] build-environment: # Results in installation to /snap/doctl/current/opt/sandbox - OVERRIDE_SANDBOX_DIR: "$SNAPCRAFT_PART_INSTALL/opt/sandbox" - SNAP_SANDBOX_INSTALL: "true" # Override to prevent 'invalid cross-device link' calling doctl - XDG_CONFIG_HOME: "$SNAPCRAFT_PART_INSTALL/tmp/.config" - override-pull: | - git clone https://github.com/digitalocean/doctl.git . override-build: | version=$(scripts/version.sh --snap) - snapcraftctl set-version ${version} + craftctl set version=${version} echo "==> Building doctl ${version} using $(go version)"