Skip to content

test(timing): increase delays and thresholds for CI stability #33

test(timing): increase delays and thresholds for CI stability

test(timing): increase delays and thresholds for CI stability #33

Workflow file for this run

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
permissions:
contents: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
name: Build (${{ matrix.platform }})
strategy:
matrix:
include:
- os: macos-15
platform: macos
arch: "arm64 --arch x86_64"
build-path: apple/Products/Release
archive-name: exfig-macos
- os: ubuntu-latest
platform: linux-x64
arch: x86_64
build-path: x86_64-unknown-linux-gnu/release
archive-name: exfig-linux-x64
container: swift:6.0
extra-flags: --static-swift-stdlib -Xlinker -lcurl -Xlinker -lxml2 -Xlinker -lssl -Xlinker -lcrypto -Xlinker -lz
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v5
- name: Select Xcode 16.3 (macOS)
if: matrix.platform == 'macos'
run: sudo xcode-select -s /Applications/Xcode_16.3.app/Contents/Developer
- name: Install system dependencies (Linux)
if: matrix.platform == 'linux-x64'
run: |
apt-get update
apt-get install -y libcurl4-openssl-dev libxml2-dev libssl-dev
- name: Set version from tag
run: |
VERSION="${GITHUB_REF#refs/tags/}"
FILE="Sources/ExFig/ExFigCommand.swift"
if [ "${{ matrix.platform }}" = "macos" ]; then
sed -i '' "s/static let version = \".*\"/static let version = \"$VERSION\"/" "$FILE"
else
sed -i "s/static let version = \".*\"/static let version = \"$VERSION\"/" "$FILE"
fi
- name: Build release binary
run: swift build -c release --arch ${{ matrix.arch }} ${{ matrix.extra-flags }}
- name: Create release archive (macOS)
if: matrix.platform == 'macos'
run: |
mkdir -p dist
cp .build/${{ matrix.build-path }}/exfig dist/ExFig
cp -r .build/${{ matrix.build-path }}/exfig_AndroidExport.bundle dist/
cp -r .build/${{ matrix.build-path }}/exfig_XcodeExport.bundle dist/
cp -r .build/${{ matrix.build-path }}/exfig_FlutterExport.bundle dist/
cp -r .build/${{ matrix.build-path }}/exfig_WebExport.bundle dist/
cp LICENSE dist/
cd dist && zip -r ../${{ matrix.archive-name }}.zip .
- name: Create release archive (Linux)
if: matrix.platform == 'linux-x64'
run: |
mkdir -p dist
cp .build/${{ matrix.build-path }}/exfig dist/ExFig
cp -r .build/${{ matrix.build-path }}/exfig_AndroidExport.resources dist/
cp -r .build/${{ matrix.build-path }}/exfig_XcodeExport.resources dist/
cp -r .build/${{ matrix.build-path }}/exfig_FlutterExport.resources dist/
cp -r .build/${{ matrix.build-path }}/exfig_WebExport.resources dist/
cp LICENSE dist/
tar -czf ${{ matrix.archive-name }}.tar.gz -C dist .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.archive-name }}
path: |
${{ matrix.archive-name }}.zip
${{ matrix.archive-name }}.tar.gz
if-no-files-found: ignore
update-version:
name: Update Version and Changelog
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
ref: main
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update version in main branch
run: |
VERSION="${GITHUB_REF#refs/tags/}"
FILE="Sources/ExFig/ExFigCommand.swift"
sed -i "s/static let version = \".*\"/static let version = \"$VERSION\"/" "$FILE"
- name: Update CHANGELOG.md
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --output CHANGELOG.md
env:
GITHUB_REPO: ${{ github.repository }}
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Sources/ExFig/ExFigCommand.swift CHANGELOG.md
git diff --staged --quiet || git commit -m "chore(release): bump version to ${GITHUB_REF#refs/tags/v}"
git push origin main
release:
name: Create Release
needs: [build, update-version]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Generate release notes
id: changelog
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --latest --strip header
env:
GITHUB_REPO: ${{ github.repository }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.changelog.outputs.content }}
files: |
artifacts/exfig-macos/exfig-macos.zip
artifacts/exfig-linux-x64/exfig-linux-x64.tar.gz
update-homebrew:
name: Update Homebrew Tap
needs: release
runs-on: ubuntu-latest
steps:
- name: Get version from tag
id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Download release assets and calculate SHA256
id: sha
run: |
VERSION="${{ steps.version.outputs.version }}"
curl -sL "https://github.com/alexey1312/ExFig/releases/download/v${VERSION}/exfig-macos.zip" -o exfig-macos.zip
MACOS_SHA=$(sha256sum exfig-macos.zip | cut -d' ' -f1)
echo "macos=${MACOS_SHA}" >> $GITHUB_OUTPUT
curl -sL "https://github.com/alexey1312/ExFig/releases/download/v${VERSION}/exfig-linux-x64.tar.gz" -o exfig-linux.tar.gz
LINUX_SHA=$(sha256sum exfig-linux.tar.gz | cut -d' ' -f1)
echo "linux=${LINUX_SHA}" >> $GITHUB_OUTPUT
- name: Checkout Homebrew tap
uses: actions/checkout@v5
with:
repository: alexey1312/homebrew-exfig
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: homebrew-exfig
- name: Update formula
run: |
VERSION="${{ steps.version.outputs.version }}"
MACOS_SHA="${{ steps.sha.outputs.macos }}"
LINUX_SHA="${{ steps.sha.outputs.linux }}"
FORMULA="homebrew-exfig/Formula/exfig.rb"
sed -i "s/version \".*\"/version \"${VERSION}\"/" "$FORMULA"
sed -i "0,/sha256 \"[a-f0-9]*\"/s//sha256 \"${MACOS_SHA}\"/" "$FORMULA"
sed -i "0,/sha256 \"${MACOS_SHA}\"/! {0,/sha256 \"[a-f0-9]*\"/s//sha256 \"${LINUX_SHA}\"/}" "$FORMULA"
cat "$FORMULA"
- name: Commit and push
working-directory: homebrew-exfig
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/exfig.rb
git diff --staged --quiet || git commit -m "chore: bump to v${{ steps.version.outputs.version }}"
git push