Skip to content

chore: bump version #35

chore: bump version

chore: bump version #35

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*' # Triggers on version tags like v1.0.0
permissions:
contents: write
attestations: write
id-token: write
jobs:
build:
name: Build on ${{ matrix.artifact_name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-linux
artifact_name: linux-x86_64
- os: macos-latest
target: x86_64-macos
artifact_name: macos-x86_64
- os: macos-latest
target: aarch64-macos
artifact_name: macos-aarch64
- os: windows-latest
target: x86_64-windows
artifact_name: windows-x86_64
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2
cache-key: ${{ matrix.artifact_name }}-${{ matrix.target }}
- name: Run tests
run: zig build test
- name: Build project
run: zig build -Doptimize=ReleaseFast -Dtarget=${{ matrix.target }} --summary all -Dstrip
- name: Prepare artifacts (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p artifacts
cp zig-out/bin/* artifacts/ || true
cd artifacts
tar -czf ../copper-${{ matrix.artifact_name }}.tar.gz *
- name: Generate artifact attestation (Unix)
if: runner.os != 'Windows'
uses: actions/attest-build-provenance@v3
with:
subject-path: copper-${{ matrix.artifact_name }}.tar.gz
- name: Prepare artifacts (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path artifacts
Copy-Item zig-out/bin/* artifacts/ -ErrorAction SilentlyContinue
Compress-Archive -Path artifacts/* -DestinationPath copper-${{ matrix.artifact_name }}.zip
- name: Generate artifact attestation (Windows)
if: runner.os == 'Windows'
uses: actions/attest-build-provenance@v3
with:
subject-path: copper-${{ matrix.artifact_name }}.zip
- name: Upload build artifacts
uses: actions/upload-artifact@v6
with:
name: copper-${{ matrix.artifact_name }}
path: |
copper-${{ matrix.artifact_name }}.tar.gz
copper-${{ matrix.artifact_name }}.zip
if-no-files-found: error
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get previous tag from copper repo
id: get_previous_tag
run: |
TAG_NAME=$(curl -s https://api.github.com/repos/logotip4ik/copper/releases/latest | jq -r '.tag_name')
if [ -z "$TAG_NAME" ]; then
TAG_NAME=""
fi
# Set output for use in next steps
echo "previous_from_tag=$TAG_NAME" >> $GITHUB_OUTPUT
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v6
with:
mode: COMMIT
# allows to generate release notes if previous release failed
fromTag: ${{ steps.get_previous_tag.outputs.previous_from_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download all artifacts
uses: actions/download-artifact@v7
with:
path: artifacts
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
draft: false
prerelease: false
body: ${{steps.github_release.outputs.changelog}}