Skip to content

Commit

Permalink
Merge pull request #142 from HarborWallet/release-action
Browse files Browse the repository at this point in the history
try a different release strategy
  • Loading branch information
futurepaul authored Jan 31, 2025
2 parents 3b887f3 + c48f601 commit bcce43b
Showing 1 changed file with 23 additions and 60 deletions.
83 changes: 23 additions & 60 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
name: "Release"

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: "Specify tag to create"
description: 'Tag name (e.g. v1.0.0)'
required: true
type: string

# Add permissions block
permissions:
contents: write

jobs:
build:
Expand All @@ -19,71 +27,26 @@ jobs:
package: bash scripts/package-macos.sh
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

Check warning on line 32 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / Build (macos, macos-latest, bash scripts/build-macos.sh, bash scripts/package-macos.sh)

Magic Nix Cache is deprecated

Magic Nix Cache has been deprecated due to a change in the underlying GitHub APIs and will stop working on 1 February 2025. To continue caching Nix builds in GitHub Actions, use FlakeHub Cache instead. Replace... - uses: DeterminateSystems/magic-nix-cache-action@main ...with... - uses: DeterminateSystems/flakehub-cache-action@main For more details: https://dtr.mn/magic-nix-cache-eol
- uses: DeterminateSystems/flake-checker-action@main
- uses: Swatinem/rust-cache@v2
with:
profile: minimal
toolchain: stable
override: true
env-vars: CARGO USE_VENDOR_FEATURE

- name: Build
run: ${{ matrix.target.make }}
run: nix develop --command bash -c "${{ matrix.target.make }}"

- name: Package DMG
run: ${{ matrix.target.package }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target.target }}
path: target/release/macos/harbor.dmg
run: nix develop --command bash -c "${{ matrix.target.package }}"

create-release:
needs: build
name: Create Release
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Create Release
id: create-release
uses: actions/create-release@v1
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.tag }}
release_name: ${{ github.event.inputs.tag }}
name: Release ${{ github.event.inputs.tag || github.ref_name }}
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
draft: true
prerelease: false

add-assets:
needs: create-release
name: Add Assets

strategy:
matrix:
target:
- artifact: macos
asset_type: application/x-apple-diskimage

runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.target.artifact }}
path: ${{ matrix.target.artifact }}

- name: Upload asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./${{ matrix.target.artifact }}/harbor.dmg
asset_name: harbor.dmg
asset_content_type: ${{ matrix.target.asset_type }}
generate_release_notes: true
files: target/release/macos/harbor.dmg

0 comments on commit bcce43b

Please sign in to comment.