Skip to content

Commit

Permalink
build: refactor Linux + start Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickDinh committed Mar 26, 2024
1 parent 892fb2b commit 7cd7094
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 27 deletions.
17 changes: 10 additions & 7 deletions .github/actions/build-linux/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ name: 'Build for Linux'
inputs:
release-version:
description: 'The release version'
outputs:
artifact-name:
description: 'The name of the artifact'
value: algokit-explorer-linux.tar.gz

env:
ARTIFACT_NAME: algokit-explorer-linux-${{ runner.arch }}
runs:
using: 'composite'
steps:
Expand Down Expand Up @@ -41,13 +39,18 @@ runs:
- name: Zip to preserve permissions
run: |
cd tauri-dist
tar -czvf ../algokit-explorer-linux.tar.gz .
tar -czvf ../${{ env.ARTIFACT_NAME }}.tar.gz .
shell: bash

- name: Upload binary as artifact
id: upload-artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: algokit-explorer-linux
path: algokit-explorer-linux.tar.gz
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_NAME }}.tar.gz

outputs:
artifact-name:
description: 'The name of the artifact'
value: ${{ env.ARTIFACT_NAME }}.tar.gz
18 changes: 10 additions & 8 deletions .github/actions/build-windows/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ name: 'Build for Windows'
inputs:
release-version:
description: 'The release version'
outputs:
artifact-name:
description: 'The name of the artifact'
value: algokit-explorer-windows-${{ runner.arch }}

env:
ARTIFACT_NAME: algokit-explorer-windows-${{ runner.arch }}
runs:
using: 'composite'
steps:
Expand All @@ -27,14 +25,18 @@ runs:

- name: Move binary to target directory
run: |
mkdir -p dist
mv src-tauri/target/release/algokit-explorer dist/algokit-explorer
mkdir -p windows-dist
mv src-tauri/target/release/*.msi windows-dist/
shell: bash

- name: Upload binary as artifact
id: upload-artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: algokit-explorer-windows-${{ runner.arch }}
path: dist/**/*
name: ${{ env.ARTIFACT_NAME}}
path: windows-dist/**/*
outputs:
artifact-name:
description: 'The name of the artifact'
value: ${{ env.ARTIFACT_NAME }}
18 changes: 9 additions & 9 deletions .github/actions/publish-linux-snap/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ inputs:
release-version:
description: 'The release version'
required: true
artifact-zip-file-name:
artifact-name:
description: 'The name of the artifact zip file'
required: true

Expand All @@ -13,7 +13,7 @@ runs:
- name: Unzip
run: |
mkdir -p artifacts
tar -xzvf ${{ inputs.artifact-zip-file-name }} -C artifacts
tar -xzvf ${{ inputs.artifact-name }} -C artifacts
shell: bash

- name: Check artifacts dir
Expand All @@ -32,13 +32,13 @@ runs:
snapcraft-args: --target-arch amd64

#TODO: in this action, we only publish the snap as an artifact for testing purposes
# - name: Upload binary as artifact
# id: upload-artifact
# uses: actions/upload-artifact@v3
# with:
# name: algokit-explorer-linux-snap
# path: |
# *.snap
- name: Upload binary as artifact
id: upload-artifact
uses: actions/upload-artifact@v3
with:
name: algokit-explorer-linux-snap
path: |
*.snap
# once we have the release token, we will publish the snap to Snap Store
# - name: Set path to snap binary
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-20.04]
platform: [ubuntu-20.04, windows-latest]
if: ${{ needs.create-release.outputs.release-published == 'true' }}

steps:
Expand All @@ -102,8 +102,16 @@ jobs:
uses: ./.github/actions/build-linux
with:
release-version: ${{ needs.create-release.outputs.release-version }}

- name: Build for Windows
id: build-windows
if: ${{ runner.os == 'Windows' }}
uses: ./.github/actions/build-windows
with:
release-version: ${{ needs.create-release.outputs.release-version }}
outputs:
linux-artifact-name: ${{ steps.build-linux.outputs.artifact-name }}
windows-artifact-name: ${{ steps.build-windows.outputs.artifact-name }}

publish:
name: Publish
Expand All @@ -123,8 +131,7 @@ jobs:
merge-multiple: true

- name: Publish Linux Snap
if: ${{ runner.os == 'Linux' }}
uses: ./.github/actions/publish-linux-snap
with:
release-version: ${{ needs.create-release.outputs.release-version }}
artifact-zip-file-name: ${{ needs.build-tauri.outputs.linux-artifact-name }}
artifact-name: ${{ needs.build-tauri.outputs.linux-artifact-name }}

0 comments on commit 7cd7094

Please sign in to comment.