Skip to content

Release

Release #20

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
type: string
title:
description: 'Release title'
required: true
type: string
branch:
description: 'Release branch'
required: false
type: string
default: 'main'
env:
DEVELOPER_DIR: /Applications/Xcode_16.2.app
MACOS_BUILD_DIR: .build/universal
LINUX_BUILD_DIR: .build/linux
jobs:
prepare-release:
name: Prepare Release
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create release branch
if: inputs.branch != 'main'
run: git checkout -b ${{ inputs.branch }}
- name: Update changelog
run: "sed -i 's/## Main/## ${{ inputs.version }}: ${{ inputs.title }}/g' CHANGELOG.md"
- name: Update built-in versions
run: |
sed 's/__VERSION__/${{ inputs.version }}/g' tools/Version.swift.template > Source/SwiftLintFramework/Models/Version.swift
sed -i -e '3s/.*/ version = "${{ inputs.version }}",/' MODULE.bazel
- name: Configure author
run: |
git config --local user.name "Danny Mösch"
git config --local user.email "[email protected]"
- name: Commit changes
id: pre_release
run: |
git commit -a -m "Prepare ${{ inputs.version }} release"
git push origin HEAD
build-docker:
name: Build Linux Binaries
needs: prepare-release
uses: ./.github/workflows/docker.yml
secrets: inherit
with:
ref: ${{ inputs.branch }}
tag: ${{ inputs.version }}
build-macos:
name: Build macOS Binaries
needs: prepare-release
runs-on: macOS-14
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Build SwiftLint for macOS
run: make --debug bazel_release
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: swiftlint
path: |
swiftlint
bazel.tar.gz
bazel.tar.gz.sha256
retention-days: 2
if-no-files-found: error
create-release:
name: Create Release
needs:
- build-docker
- build-macos
runs-on: macOS-14
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Configure author
run: |
git config --local user.name "Danny Mösch"
git config --local user.email "[email protected]"
- name: Create build folders
run: mkdir -p ${{ env.MACOS_BUILD_DIR }} ${{ env.LINUX_BUILD_DIR }}
- name: Download binary artifact for macOS
uses: actions/download-artifact@v4
with:
name: swiftlint
path: ${{ env.MACOS_BUILD_DIR }}
- name: Download binary artifact for Linux
uses: actions/download-artifact@v4
with:
name: swiftlint_linux_amd64
path: ${{ env.LINUX_BUILD_DIR }}
- name: Move Bazel release
run: mv -f ${{ env.MACOS_BUILD_DIR }}/bazel.tar.gz ${{ env.MACOS_BUILD_DIR }}/bazel.tar.gz.sha256 .
- name: Make binaries executable
run: chmod +x ${{ env.MACOS_BUILD_DIR }}/swiftlint ${{ env.LINUX_BUILD_DIR }}/swiftlint_linux_amd64
- name: Create artifacts
run: |
make --debug spm_artifactbundle
make --debug package
make --debug portable_zip
make --debug zip_linux_release
- name: Update binary target in Swift package
run: ./tools/update-artifact-bundle.sh "${{ inputs.version }}"
- name: Create tag and release commit
run: |
git commit -a -m "Release ${{ inputs.version }}"
git tag -a "${{ inputs.version }}" -m "${{ inputs.title }}"
git push origin HEAD
git push origin "${{ inputs.version }}"
- name: Create release
run: ./tools/create-github-release.sh "${{ inputs.version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add new changelog section
run: |
./tools/add-new-changelog-section.sh
git commit -a -m "Add new changelog section"
git push origin HEAD