Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try a different release strategy #142

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 / ci

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
Loading