Skip to content
Merged
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
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
name: Build and Test
Expand All @@ -15,6 +19,14 @@ jobs:
with:
fetch-depth: 0

- name: Cache Swift packages
uses: actions/cache@v4
with:
path: .build
key: spm-${{ runner.os }}-${{ hashFiles('Package.swift') }}
restore-keys: |
spm-${{ runner.os }}-

- name: Build
run: swift build

Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Release
on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
name: Build and Release
Expand All @@ -15,6 +19,14 @@ jobs:
with:
fetch-depth: 0

- name: Cache Swift packages
uses: actions/cache@v4
with:
path: .build
key: spm-${{ runner.os }}-${{ hashFiles('Package.swift') }}
restore-keys: |
spm-${{ runner.os }}-

- name: Validate version
id: version
uses: ./.github/actions/validate-version
Expand All @@ -24,10 +36,20 @@ jobs:
- name: Build release binary
run: swift build -c release

- name: Generate release notes
run: |
PREV_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -n1)
if [ -z "$PREV_TAG" ]; then
git log --pretty=format:"- %s" HEAD > release-notes.txt
else
git log --pretty=format:"- %s" ${PREV_TAG}..HEAD > release-notes.txt
fi

- name: Create release
uses: diogot/gh-actions-workflows/actions/create-release@main
with:
tag: v${{ steps.version.outputs.version }}
title: v${{ steps.version.outputs.version }}
body-file: release-notes.txt
files: .build/release/swift-outdated
token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions Plugins/BuildVersionPlugin/plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct BuildVersionPlugin: BuildToolPlugin {
let outputFile = context.pluginWorkDirectoryURL.appending(path: "GeneratedVersion.swift")

return [
.prebuildCommand(
.buildCommand(
displayName: "Generate version from VERSION file",
executable: URL(fileURLWithPath: "/bin/bash"),
arguments: [
Expand All @@ -23,7 +23,8 @@ struct BuildVersionPlugin: BuildToolPlugin {
EOF
"""
],
outputFilesDirectory: context.pluginWorkDirectoryURL
inputFiles: [versionFile],
outputFiles: [outputFile]
)
]
}
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1
1.0.2