Skip to content

Commit 3a90eac

Browse files
committed
build: wip - snap
1 parent deeac00 commit 3a90eac

File tree

4 files changed

+90
-5
lines changed

4 files changed

+90
-5
lines changed

.github/actions/build-ubuntu/action.yaml renamed to .github/actions/build-linux/action.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
name: 'Build for Ubuntu'
1+
name: 'Build for Linux'
22
inputs:
33
release-version:
44
description: 'The release version'
5+
outputs:
6+
artifact-name:
7+
description: 'The name of the artifact'
8+
value: algokit-explorer-linux-${{ runner.arch }}
59

610
runs:
711
using: 'composite'
@@ -21,9 +25,21 @@ runs:
2125
- name: build tauri app
2226
uses: tauri-apps/tauri-action@v0
2327

28+
- name: move binary to target directory
29+
run: |
30+
mkdir -p dist-linux
31+
mv src-tauri/target/debug/algokit-explorer dist-linux
32+
shell: bash
33+
34+
- name: Generate snapcraft.yaml
35+
run: |
36+
./scripts/snap/create-snapcraft-yaml.sh ${{ github.workspace }} ${{ inputs.release-version }} "stable" "dist-linux"
37+
2438
- name: Upload binary as artifact
39+
id: upload-artifact
2540
uses: actions/upload-artifact@v3
2641
with:
2742
name: algokit-explorer-linux-${{ runner.arch }}
2843
path: |
29-
src-tauri/target/release/algokit-explorer
44+
dist-linux/algokit-explorer
45+
snap/snapcraft.yaml
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: 'Build for Linux'
2+
inputs:
3+
artifacts-path:
4+
description: 'The path to the artifacts'
5+
required: true
6+
linux-artifact-name:
7+
description: 'The name of the Linux artifact'
8+
required: true
9+
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: unzip artifacts
14+
run: unzip -q ${{ inputs.artifacts-path }}/${{ inputs.linux-artifact-name }}.zip -d linux-artifacts
15+
shell: bash
16+
17+
- name: Build snap
18+
uses: snapcore/action-build@v1
19+
with:
20+
path: linux-artifacts
21+
snapcraft-args: --target-arch amd64
22+
23+
- name: Upload binary as artifact
24+
id: upload-artifact
25+
uses: actions/upload-artifact@v3
26+
with:
27+
name: algokit-explorer-linux-snap
28+
path: |
29+
linux-artifacts/*.snap
30+
31+
#TODO: in this action, we only publish the snap as an artifact for testing purposes
32+
# once we have the release token, we will publish the snap to Snap Store
33+
# - name: Set path to snap binary
34+
# shell: bash
35+
# run: |
36+
# echo "SNAP_BINARY_PATH=$(find ${{ github.workspace }} -name '*.snap')" >> $GITHUB_ENV
37+
38+
# - name: Publish snap
39+
# uses: snapcore/action-publish@v1
40+
# env:
41+
# SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_RELEASE_TOKEN }}
42+
# with:
43+
# snap: ${{ env.SNAP_BINARY_PATH }}
44+
# release: stable

.github/workflows/release.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,32 @@ jobs:
9797
- name: install npm dependencies
9898
run: npm install
9999

100-
- name: build for ubuntu
100+
- name: build for Linux
101+
id: build-linux
101102
if: ${{ runner.os == 'Linux' }}
102-
uses: ./.github/actions/build-ubuntu
103+
uses: ./.github/actions/build-linux
103104
with:
104105
release-version: ${{ needs.create-release.outputs.release-version }}
106+
outputs:
107+
linux-artifact-name: ${{ steps.build-linux.outputs.artifact-name }}
108+
109+
publish:
110+
name: Publish
111+
needs:
112+
- build-tauri
113+
runs-on: [ubuntu-20.04]
114+
if: ${{ inputs.production-release == 'true' }}
115+
steps:
116+
- uses: actions/checkout@v4
117+
with:
118+
fetch-depth: 0
119+
120+
- uses: actions/download-artifact@v4
121+
with:
122+
path: artifacts
123+
124+
- name: publish Linux Snap
125+
uses: ./.github/actions/publish-linux-snap
126+
with:
127+
artifacts-path: artifacts
128+
linux-artifact-name: ${{ needs.build-tauri.outputs.linux-artifact-name }}

scripts/snap/create-snapcraft-yaml.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fi
1313
DESTINATION_DIR="$1"
1414
RELEASE_TAG="$2"
1515
GRADE="$3"
16+
SOURCE_DIR="$4"
1617

1718
# Ensure the destination directory exists
1819
mkdir -p "${DESTINATION_DIR}/snap"
@@ -34,7 +35,7 @@ grade: $GRADE
3435
3536
parts:
3637
algokit-explorer:
37-
source: snap-dist
38+
source: "$SOURCE_DIR"
3839
plugin: dump
3940
build-packages:
4041
- build-essential

0 commit comments

Comments
 (0)