Skip to content

Commit

Permalink
ci: configure snapcraft (#3900)
Browse files Browse the repository at this point in the history
* ci: configure snapcraft

* feedback

* updates

* updates
  • Loading branch information
julienrbrt committed Jan 23, 2024
1 parent 83b5ee5 commit 0dbdd2c
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 20 deletions.
29 changes: 20 additions & 9 deletions .github/workflows/release-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ name: Release Docker Image

on:
release:
types: [ published ]
push:
branches:
- main
types: [published]
schedule:
- cron: "0 0 * * *" # every day at midnight

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -15,14 +14,27 @@ jobs:
consecutiveness:
runs-on: ubuntu-latest
steps:
- uses: ignite/consecutive-workflow-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ignite/consecutive-workflow-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}

check-latest-run:
runs-on: "ubuntu-latest"
steps:
- uses: octokit/[email protected]
id: check_last_run
with:
route: GET /repos/${{github.repository}}/actions/workflows/release-docker.yml/runs?per_page=1&status=completed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
last_sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}

docker:
name: Push Docker image to Docker Hub
if: needs.check-latest-run.outputs.last_sha != github.sha
runs-on: ubuntu-latest
needs: [ consecutiveness ]
needs: [consecutiveness, check-latest-run]

steps:
- name: Check out the repo
Expand Down Expand Up @@ -59,4 +71,3 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

22 changes: 18 additions & 4 deletions .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Release nightly

on:
schedule:
- cron: "0 0 * * *" # every day at midnight
workflow_dispatch:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -18,9 +17,22 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}

check-latest-run:
runs-on: "ubuntu-latest"
steps:
- uses: octokit/[email protected]
id: check_last_run
with:
route: GET /repos/${{github.repository}}/actions/workflows/release-nightly.yml/runs?per_page=1&status=completed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
last_sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}

release-nightly:
if: needs.check-latest-run.outputs.last_sha != github.sha
runs-on: ubuntu-latest
needs: [consecutiveness]
needs: [consecutiveness, check-latest-run]
env:
working-directory: go/src/github.com/ignite/cli

Expand Down Expand Up @@ -51,7 +63,9 @@ jobs:
prerelease: true

releases-binaries:
if: needs.check-latest-run.outputs.last_sha != github.sha
name: Release Go Binary
needs: [consecutiveness, check-latest-run]
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/snapcraft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
with:
fetch-depth: 0

- name: Update snapcraft.yaml
run: |
make snapcraft.yaml version=${GITHUB_REF#refs/tags/}
- name: Build snap package
uses: snapcore/action-build@v1
id: build-snap
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ build:
@-mkdir -p $(BUILD_FOLDER) 2> /dev/null
@go build $(BUILD_FLAGS) -o $(BUILD_FOLDER) ./...

## prepare snapcraft.yaml for release
snapcraft.yaml:
@sed -i 's/{{version}}/'$(version)'/' packaging/snap/snapcraft.yaml

## prepare flatpak manifest for release
flatpak:
@sed -i 's/{{version}}/'$(version)'/' packaging/flatpak/com.ignite.Ignite.yml

## mocks: generate mocks
mocks:
@echo Generating mocks
Expand Down
8 changes: 4 additions & 4 deletions packaging/flatpak/com.ignite.Ignite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ modules:
build-commands:
- $GOROOT/bin/go build -mod=readonly -o ignt ./ignite/cmd/ignite
- install -Dm00755 ignt $FLATPAK_DEST/bin/ignite
#- install -Dm00644 packaging/flatpak/logo.svg $FLATPAK_DEST/share/icons/hicolor/scalable/apps/ignite.svg
#- install -Dm00644 packaging/flatpak/ignite.desktop $FLATPAK_DEST/share/applications/ignite.desktop
#- install -Dm00644 packaging/flatpak/ignite.metainfo.xml $FLATPAK_DEST/share/metainfo/ignite.metainfo.xml
- install -Dm00644 packaging/flatpak/logo.svg $FLATPAK_DEST/share/icons/hicolor/scalable/apps/ignite.svg
- install -Dm00644 packaging/flatpak/ignite.desktop $FLATPAK_DEST/share/applications/ignite.desktop
- install -Dm00644 packaging/flatpak/ignite.metainfo.xml $FLATPAK_DEST/share/metainfo/ignite.metainfo.xml
sources:
- type: git
url: "https://github.com/ignite/cli.git"
tag: "v28.0.0"
tag: "v{{version}}"
5 changes: 2 additions & 3 deletions packaging/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ignite
base: core22 # the base snap is the execution environment for this snap
version: "28.0.0"
version: "{{version}}"
summary: Build, launch, and maintain any crypto application with Ignite CLI # 79 char long summary
description: |
Ignite CLI offers everything you need to build, test, and launch your blockchain with a decentralized worldwide community. Ignite CLI is built on top of Cosmos SDK, the world's most popular blockchain framework.
Expand All @@ -13,12 +13,11 @@ parts:
ignite:
plugin: go
source: https://github.com/ignite/cli.git
source-tag: v28.0.0
source-tag: v{{version}}
source-subdir: ignite/cmd/ignite
build-snaps:
- go

apps:
ignite:
command: bin/ignite
plugs: [home, network, network-bind, removable-media]

0 comments on commit 0dbdd2c

Please sign in to comment.