Skip to content
Closed
Show file tree
Hide file tree
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
47 changes: 32 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@ name: Release

on:
workflow_dispatch:
release:
types: [published]
inputs:
version:
description: "Version to release (e.g. 2.7.0)"
required: true
type: string
dry_run:
description: "Dry run"
required: true
type: boolean

permissions:
contents: write

jobs:
build:
Expand All @@ -14,16 +24,18 @@ jobs:
destination:
- { name: "ubuntu-aarch64", os: ubuntu-22.04-arm }
- { name: "ubuntu-x86_64", os: ubuntu-22.04 }
- { name: "macos-universal", os: macos-15 }
- { name: "macos-universal", os: macos-26 }
steps:
- if: startsWith(matrix.destination.name, 'ubuntu')
uses: vapor/swiftly-action@v0.2
with:
toolchain: "6.2"
- if: startsWith(matrix.destination.name, 'macos')
run: sudo xcode-select -s /Applications/Xcode_26.1.app
run: sudo xcode-select -s /Applications/Xcode_26.3.app

- uses: actions/checkout@v6
- name: Update Sources/Mockolo/Version.swift
run: echo "let version = \"${{ inputs.version }}\"" > Sources/Mockolo/Version.swift
- name: Create the binary
run: ./install-script.sh -s . -t mockolo -d . -o mockolo.${{ matrix.destination.name }}.tar.gz
- name: Upload the binary
Expand Down Expand Up @@ -68,44 +80,49 @@ jobs:
with:
merge-multiple: true

- run: bundle/make_artifactbundle.sh ${{ github.event.release.tag_name || github.ref_name }}
- run: bundle/make_artifactbundle.sh "${{ inputs.version }}"

- name: Upload artifact bundle
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v7
with:
name: mockolo.artifactbundle.zip
path: mockolo.artifactbundle.zip
archive: false

- name: Compute checksum
id: checksum
run: echo "checksum=$(swift package compute-checksum mockolo.artifactbundle.zip)" >> "$GITHUB_OUTPUT"
run: echo "checksum=$(swift package compute-checksum mockolo.artifactbundle.zip)" | tee -a "$GITHUB_OUTPUT"

deploy-binary:
if: ${{ github.event_name == 'release' }}
publish:
if: ${{ !inputs.dry_run }}
needs: [check-portability, make-artifact-bundle]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v7
with:
merge-multiple: true
- name: Deploy the binary
skip-decompress: true
- name: Publish to GitHub Releases
uses: softprops/action-gh-release@v2
with:
name: ${{ inputs.version }}
tag_name: ${{ inputs.version }}
target_commitish: ${{ github.sha }}
body: |
----

## For Build Tools Plugin (artifactbundle)

```swift
.binaryTarget(
name: "mockolo",
url: "https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/mockolo.artifactbundle.zip",
url: "https://github.com/${{ github.repository }}/releases/download/${{ inputs.version }}/mockolo.artifactbundle.zip",
checksum: "${{ needs.make-artifact-bundle.outputs.checksum }}"
),
```

append_body: true
generate_release_notes: true
files: |
mockolo.ubuntu-x86_64.tar.gz
mockolo.ubuntu-aarch64.tar.gz
mockolo.macos-universal.tar.gz
mockolo.artifactbundle.zip
fail_on_unmatched_files: true
draft: true
2 changes: 1 addition & 1 deletion Sources/Mockolo/Mockolo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct Mockolo {
static func main() {
let inputs = Array(CommandLine.arguments.dropFirst())
if let arg = inputs.first, (arg == "--version" || arg == "-v") {
print(Version.current.value)
print(version)
return
}

Expand Down
1 change: 1 addition & 0 deletions Sources/Mockolo/Version.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let version = "development"
7 changes: 0 additions & 7 deletions Sources/MockoloFramework/Version.swift

This file was deleted.