Skip to content

ci: Add CI workflow with build, release, and funding configuration #2

ci: Add CI workflow with build, release, and funding configuration

ci: Add CI workflow with build, release, and funding configuration #2

Workflow file for this run

name: build
on:
push:
tags:
- '*'
jobs:
version:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.vars.outputs.VERSION }}
steps:
# The `fetch-depth: 0` is important to fetch all the tags
- name: Code checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set version
id: vars
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
build-macos:
runs-on: macos-latest
needs: [ version ]
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build binaries
run: |
brew install go-task
node scripts/replace.mjs mediaorient.go "<version>=>${{ needs.version.outputs.VERSION }}"
task package oses=darwin archs='amd64 arm64'
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-macos
path: build/*.zip
build-linux-amd64:
runs-on: ubuntu-latest
needs: [ version ]
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build binaries
run: |
npm install -g @go-task/cli
node scripts/replace.mjs mediaorient.go "<version>=>${{ needs.version.outputs.VERSION }}"
task package oses=linux archs=amd64
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-linux-amd64
path: build/*.zip
build-linux-arm64:
runs-on: ubuntu-24.04-arm
needs: [ version ]
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build binaries
run: |
npm install -g @go-task/cli
node scripts/replace.mjs mediaorient.go "<version>=>${{ needs.version.outputs.VERSION }}"
task package oses=linux archs=arm64
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-linux-arm64
path: build/*.zip
build-windows-amd64:
runs-on: windows-latest
needs: [ version ]
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build binaries
run: |
npm install -g @go-task/cli
node scripts/replace.mjs mediaorient.go "<version>=>${{ needs.version.outputs.VERSION }}"
task package oses=windows archs=amd64
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-windows-amd64
path: build/*.zip
build-windows-arm64:
runs-on: windows-11-arm
needs: [ version ]
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Install MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: CLANGARM64
update: true
install: |
mingw-w64-clang-aarch64-gcc-compat
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build binaries
shell: msys2 {0}
env:
MSYS2_PATH_TYPE: inherit
MSYSTEM: CLANGARM64
CC: aarch64-w64-mingw32-gcc
CXX: aarch64-w64-mingw32-g++
run: |
npm install -g @go-task/cli
node scripts/replace.mjs mediaorient.go "<version>=>${{ needs.version.outputs.VERSION }}"
task package oses=windows archs=arm64
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-windows-arm64
path: build/*.zip
release:
runs-on: ubuntu-latest
needs: [ build-macos, build-linux-amd64, build-linux-arm64, build-windows-amd64, build-windows-arm64 ]
permissions:
contents: write
steps:
# The `fetch-depth: 0` is important to fetch all the tags
- name: Code checkout
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Fetch artifact
uses: actions/download-artifact@v4
with:
path: binaries
merge-multiple: true
- name: Create the changelog
run: |
npm install -g release-it @release-it/conventional-changelog
release-it --ci
- name: Create release
uses: ncipollo/release-action@v1
with:
name: ${{ needs.version.outputs.VERSION }}
tag: ${{ needs.version.outputs.VERSION }}
bodyFile: CHANGELOG.md
replacesArtifacts: true
artifacts: binaries/*.zip