Skip to content

Create release v3.5.2 #18

Create release v3.5.2

Create release v3.5.2 #18

Workflow file for this run

name: Create-Release
run-name: Create release ${{github.ref_name}}
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
Checks:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set version
run: |
echo VERSION="$(echo '${{github.ref_name}}' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')" >> $GITHUB_ENV
- name: Check app.rc version
run: |
[ $(grep "${{env.VERSION}}" res/win/app.rc | grep -iE '(File|Product)Version' | wc -l) = 4 ]
- name: Check release_notes.md version
run: |
for v in $(grep -oE '[0-9]+\.[0-9]+\.[0-9]+' .github/workflows/resources/release_notes.md); do \
grep -qF "${{env.VERSION}}" <<<"$v"; \
done
Build-and-Test:
uses: ./.github/workflows/build-test.yml
permissions:
contents: write
pull-requests: write
security-events: write
needs: Checks
Linux:
runs-on: ubuntu-latest
timeout-minutes: 20
needs:
- Checks
- Build-and-Test
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set version
run: |
version="$(echo '${{github.ref_name}}' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')"
archive="clip_share_server-${version}-linux_x86_64"
echo ARCHIVE_NAME_NO_EXT="${archive}" >> $GITHUB_ENV
echo ARCHIVE_NAME="${archive}.tar.gz" >> $GITHUB_ENV
- name: Build on Ubuntu 18
run: docker build -t clipshare:ubuntu18 -f docker/release/Dockerfile.ubuntu18 .
- name: Build on Ubuntu 20
run: docker build -t clipshare:ubuntu20 -f docker/release/Dockerfile.ubuntu20 .
- name: Build on Ubuntu 22
run: docker build -t clipshare:ubuntu22 -f docker/release/Dockerfile.ubuntu22 .
- name: Build on Ubuntu 24
run: docker build -t clipshare:ubuntu24 -f docker/release/Dockerfile.ubuntu24 .
- name: Build on Arch Linux
run: docker build -t clipshare:arch -f docker/release/Dockerfile.arch .
- name: Build on Fedora
run: docker build -t clipshare:fedora -f docker/release/Dockerfile.fedora .
- name: Copy binaries
run: |
mkdir dist
chmod 777 dist
docker run -v './dist:/home/user/src/dist' clipshare:ubuntu18
docker run -v './dist:/home/user/src/dist' clipshare:ubuntu20
docker run -v './dist:/home/user/src/dist' clipshare:ubuntu22
docker run -v './dist:/home/user/src/dist' clipshare:ubuntu24
docker run -v './dist:/home/user/src/dist' clipshare:arch
docker run -v './dist:/home/user/src/dist' clipshare:fedora
[ -f helper_tools/install-linux.sh ] && cp helper_tools/install-linux.sh dist/
sudo chmod +x dist/*
cd dist
sha256sum -b * >SHA2-256SUM
cd ..
mv dist "${{env.ARCHIVE_NAME_NO_EXT}}"
tar -cf - --sort=name --owner=root:0 --group=root:0 --no-same-owner "${{env.ARCHIVE_NAME_NO_EXT}}" | \
gzip -9 >"${{env.ARCHIVE_NAME}}"
- name: Upload Linux version
uses: actions/upload-artifact@v4
with:
name: "${{env.ARCHIVE_NAME}}"
path: "${{env.ARCHIVE_NAME}}"
retention-days: 3
if-no-files-found: error
compression-level: 0
Windows:
runs-on: windows-latest
timeout-minutes: 10
needs:
- Checks
- Build-and-Test
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-make
mingw-w64-x86_64-openssl
mingw-w64-x86_64-libpng
mingw-w64-x86_64-libunistring
zip
- name: Setup make
run: ln -s /mingw64/bin/mingw32-make.exe /mingw64/bin/make.exe
- name: Check out repository code
uses: actions/checkout@v4
- name: Set variables
run: |
version="$(echo '${{github.ref_name}}' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')"
archive="clip_share_server-${version}-windows64.zip"
echo VERSION="$version" >> $GITHUB_ENV
echo FILE_NAME="clip_share.exe" >> $GITHUB_ENV
echo ARCHIVE_NAME="$archive" >> $GITHUB_ENV
echo INSTALLER_NAME="install-windows.bat" >> $GITHUB_ENV
- name: Build
run: |
make
mkdir dist
mv "clip_share.exe" "dist/${{env.FILE_NAME}}"
[ -f helper_tools/install-windows.bat ] && cp helper_tools/install-windows.bat dist/
cd dist
zip -9 "../${{env.ARCHIVE_NAME}}" *
- name: Create online installer
run: |
cd helper_tools
sed -i "s/VERSION_DEFAULT =$/VERSION_DEFAULT = '${{env.VERSION}}'/" install-online-windows.ps1
powershell -ExecutionPolicy bypass ./ps2bat.ps1
mv install.bat "../${{env.INSTALLER_NAME}}"
- name: Upload Windows version
uses: actions/upload-artifact@v4
with:
name: "${{env.ARCHIVE_NAME}}"
path: "${{env.ARCHIVE_NAME}}"
retention-days: 3
if-no-files-found: error
compression-level: 9
- name: Upload online installer
uses: actions/upload-artifact@v4
with:
name: "${{env.INSTALLER_NAME}}"
path: "${{env.INSTALLER_NAME}}"
retention-days: 3
if-no-files-found: error
compression-level: 6
macOS:
needs:
- Checks
- Build-and-Test
strategy:
matrix:
os:
- macos-latest
- macos-13
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- name: Install dependencies
run: brew install openssl@3 libpng libunistring
- name: Check out repository code
uses: actions/checkout@v4
- name: Set version
run: |
arch_suffix="$(uname -a | grep -q x86_64 && echo x86_64 || echo arm64)"
filename="clip_share-${arch_suffix}"
echo FILE_NAME="$filename" >> $GITHUB_ENV
- name: Build
run: |
make
mv "clip_share" "${{env.FILE_NAME}}"
- name: Upload macOS binary
uses: actions/upload-artifact@v4
with:
name: "${{env.FILE_NAME}}"
path: "${{env.FILE_NAME}}"
retention-days: 1
if-no-files-found: error
compression-level: 0
macOS_all:
needs: macOS
runs-on: macos-latest
timeout-minutes: 5
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set version
run: |
version="$(echo '${{github.ref_name}}' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')"
archive_name="clip_share_server-${version}-macos.zip"
echo ARCHIVE_NAME="$archive_name" >> $GITHUB_ENV
echo FILE_INTEL="clip_share-x86_64" >> $GITHUB_ENV
echo FILE_ARM="clip_share-arm64" >> $GITHUB_ENV
- name: Download macOS x86_64 version
uses: actions/download-artifact@v4
with:
name: "${{env.FILE_INTEL}}"
path: "${{env.FILE_INTEL}}"
- name: Download macOS ARM64 version
uses: actions/download-artifact@v4
with:
name: "${{env.FILE_ARM}}"
path: "${{env.FILE_ARM}}"
- name: Archive
run: |
mkdir dist
mv "${{env.FILE_INTEL}}/${{env.FILE_INTEL}}" "${{env.FILE_ARM}}/${{env.FILE_ARM}}" dist/
[ -f helper_tools/install-mac.sh ] && cp helper_tools/install-mac.sh dist/
chmod +x dist/*
cd dist
rm -f .DS_Store
zip -9 "../${{env.ARCHIVE_NAME}}" *
- name: Upload macOS version
uses: actions/upload-artifact@v4
with:
name: "${{env.ARCHIVE_NAME}}"
path: "${{env.ARCHIVE_NAME}}"
retention-days: 3
if-no-files-found: error
compression-level: 0
Create_Release:
needs:
- Linux
- Windows
- macOS_all
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
id-token: write
attestations: write
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set variables
run: |
version="$(echo '${{github.ref_name}}' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')"
echo VERSION="$version" >> $GITHUB_ENV
echo TAG="v${version}" >> $GITHUB_ENV
echo TITLE="Version ${version}" >> $GITHUB_ENV
echo FILE_LINUX="clip_share_server-${version}-linux_x86_64.tar.gz" >> $GITHUB_ENV
echo FILE_WINDOWS="clip_share_server-${version}-windows64.zip" >> $GITHUB_ENV
echo INSTALLER_WINDOWS="install-windows.bat" >> $GITHUB_ENV
echo FILE_MACOS="clip_share_server-${version}-macos.zip" >> $GITHUB_ENV
- name: Download Linux version
uses: actions/download-artifact@v4
with:
name: "${{env.FILE_LINUX}}"
path: "${{env.FILE_LINUX}}"
- name: Download Windows version
uses: actions/download-artifact@v4
with:
name: "${{env.FILE_WINDOWS}}"
path: "${{env.FILE_WINDOWS}}"
- name: Download Windows installer
uses: actions/download-artifact@v4
with:
name: "${{env.INSTALLER_WINDOWS}}"
path: "${{env.INSTALLER_WINDOWS}}"
- name: Download macOS version
uses: actions/download-artifact@v4
with:
name: "${{env.FILE_MACOS}}"
path: "${{env.FILE_MACOS}}"
- name: Prepare assets
run: |
mkdir release
mv "${{env.FILE_LINUX}}/${{env.FILE_LINUX}}" release/
mv "${{env.FILE_WINDOWS}}/${{env.FILE_WINDOWS}}" release/
mv "${{env.INSTALLER_WINDOWS}}/${{env.INSTALLER_WINDOWS}}" release/
mv "${{env.FILE_MACOS}}/${{env.FILE_MACOS}}" release/
mv .github/workflows/resources/clipshare.conf release/
mv helper_tools/install-online-linux-mac.sh release/install-linux-mac.sh
cd release
sed -i "s/^VERSION_DEFAULT=$/VERSION_DEFAULT=${{env.VERSION}}/" install-linux-mac.sh
sha256sum -b * >SHA2-256SUM
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-path: "release/SHA2-256SUM"
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sed -i "s/<VERSION>/${{env.VERSION}}/g" .github/workflows/resources/release_notes.md
sed -i "s/<FILE_LINUX>/${{env.FILE_LINUX}}/g" .github/workflows/resources/release_notes.md
sed -i "s/<FILE_MACOS>/${{env.FILE_MACOS}}/g" .github/workflows/resources/release_notes.md
cd release
gh release create "${{env.TAG}}" --latest --verify-tag \
--notes-file ../.github/workflows/resources/release_notes.md \
--title "${{env.TITLE}}" *