Skip to content

initial commit

initial commit #1

Workflow file for this run

name: CI
on:
push:
branches: [ main, master ]
tags: ['v*']
pull_request:
branches: [ main, master ]
jobs:
build-and-test:
name: Build and Test
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Swift packages
uses: actions/cache@v4
with:
path: |
.build
.build/checkouts
.build/reports
.swiftpm
key: ${{ runner.os }}-swift-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-swift-
- name: Show Swift version
run: swift --version
- name: Build
run: swift build
- name: Test
run: swift test --verbose
release:
name: Release on Tag
runs-on: macos-latest
if: startsWith(github.ref, 'refs/tags/')
needs: build-and-test
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Show Swift version
run: swift --version
- name: Build release
run: swift build -c release
- name: Build .app bundle
run: make app
- name: Build DMG
run: make dmg
- name: Upload DMG as artifact
uses: actions/upload-artifact@v4
with:
name: screenpranklocker-dmg
path: build/*.dmg
- name: Find DMG
id: find_dmg
run: |
set -e
dmg=$(ls build/*.dmg | head -n1)
echo "dmg=$dmg" >> $GITHUB_OUTPUT
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
body: "Automated release built by CI"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload DMG to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.find_dmg.outputs.dmg }}
asset_name: ${{ steps.find_dmg.outputs.dmg }}
asset_content_type: application/x-apple-diskimage