2021-10-03 13:13:32 +00:00
|
|
|
# Huge thanks to Alacritty, as their configuration served as a starting point for this one!
|
|
|
|
# See: https://github.com/alacritty/alacritty
|
|
|
|
|
|
|
|
name: Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-10-05 18:52:29 +00:00
|
|
|
- master
|
2021-10-06 17:16:52 +00:00
|
|
|
- dev
|
2021-10-03 13:13:32 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
extract-version:
|
|
|
|
name: extract-version
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
espanso_version: ${{ steps.version.outputs.version }}
|
|
|
|
steps:
|
2021-10-03 13:16:15 +00:00
|
|
|
- uses: actions/checkout@v2
|
2021-10-03 13:13:32 +00:00
|
|
|
- name: "Extract version"
|
|
|
|
id: "version"
|
|
|
|
run: |
|
2021-10-03 13:16:15 +00:00
|
|
|
ESPANSO_VERSION=$(cat espanso/Cargo.toml | grep version | head -1 | awk -F '"' '{ print $2 }')
|
|
|
|
echo version: $ESPANSO_VERSION
|
|
|
|
echo "::set-output name=version::v$ESPANSO_VERSION"
|
2021-10-03 13:13:32 +00:00
|
|
|
|
2021-10-04 18:42:38 +00:00
|
|
|
create-release:
|
|
|
|
name: create-release
|
2021-10-03 13:13:32 +00:00
|
|
|
needs: ["extract-version"]
|
2021-10-04 18:42:38 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-10-06 17:16:52 +00:00
|
|
|
- name: Create new release (only on master)
|
|
|
|
if: ${{ github.ref == 'refs/heads/master' }}
|
2021-10-04 18:42:38 +00:00
|
|
|
run: |
|
2021-10-04 19:36:15 +00:00
|
|
|
COMMIT_HASH=$(git rev-list --max-count=1 HEAD)
|
2021-10-04 18:42:38 +00:00
|
|
|
echo "Creating release: ${{ needs.extract-version.outputs.espanso_version }}"
|
2021-10-04 19:36:15 +00:00
|
|
|
echo "for hash: $COMMIT_HASH"
|
2021-10-04 18:42:38 +00:00
|
|
|
gh release create ${{ needs.extract-version.outputs.espanso_version }} \
|
|
|
|
-t ${{ needs.extract-version.outputs.espanso_version }} \
|
|
|
|
--notes "Automatically released by CI" \
|
2021-10-04 19:25:41 +00:00
|
|
|
--prerelease \
|
2021-10-04 19:36:15 +00:00
|
|
|
--target $COMMIT_HASH
|
2021-10-04 18:42:38 +00:00
|
|
|
|
|
|
|
windows:
|
|
|
|
needs: ["extract-version", "create-release"]
|
2021-10-03 13:13:32 +00:00
|
|
|
runs-on: windows-latest
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Print target version
|
|
|
|
run: |
|
|
|
|
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
|
2021-12-11 15:31:57 +00:00
|
|
|
- name: Install rust-script and cargo-make
|
2021-10-03 13:17:54 +00:00
|
|
|
run: |
|
2021-12-11 15:31:57 +00:00
|
|
|
cargo install rust-script --version "0.7.0"
|
2021-10-22 19:18:28 +00:00
|
|
|
cargo install --force cargo-make --version 0.34.0
|
2021-10-03 13:13:32 +00:00
|
|
|
- name: Test
|
|
|
|
run: cargo make test-binary --profile release
|
|
|
|
- name: Build
|
|
|
|
run: cargo make build-windows-all --profile release
|
|
|
|
- name: Create portable mode archive
|
|
|
|
shell: powershell
|
|
|
|
run: |
|
2021-10-03 13:56:09 +00:00
|
|
|
Rename-Item target/windows/portable espanso-portable
|
2021-10-03 14:44:30 +00:00
|
|
|
Compress-Archive target/windows/espanso-portable target/windows/Espanso-Win-Portable-x86_64.zip
|
2021-10-03 13:13:32 +00:00
|
|
|
- name: Calculate hashes
|
2021-10-03 13:56:09 +00:00
|
|
|
shell: powershell
|
2021-10-03 13:13:32 +00:00
|
|
|
run: |
|
|
|
|
Get-FileHash target/windows/Espanso-Win-Portable-x86_64.zip -Algorithm SHA256 | select-object -ExpandProperty Hash > target/windows/Espanso-Win-Portable-x86_64.zip.sha256.txt
|
2021-10-03 15:27:14 +00:00
|
|
|
Get-FileHash target/windows/installer/Espanso-Win-Installer-x86_64.exe -Algorithm SHA256 | select-object -ExpandProperty Hash > target/windows/installer/Espanso-Win-Installer-x86_64.exe.sha256.txt
|
2021-10-03 14:44:30 +00:00
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
name: "Upload artifacts"
|
|
|
|
with:
|
2021-10-03 16:29:10 +00:00
|
|
|
name: Windows Artifacts
|
2021-10-03 14:44:30 +00:00
|
|
|
path: |
|
2021-10-03 15:27:14 +00:00
|
|
|
target/windows/installer/Espanso-Win-Installer-x86_64.exe
|
2021-10-03 14:44:30 +00:00
|
|
|
target/windows/Espanso-Win-Portable-x86_64.zip
|
2021-10-03 15:27:14 +00:00
|
|
|
target/windows/installer/Espanso-Win-Installer-x86_64.exe.sha256.txt
|
|
|
|
target/windows/Espanso-Win-Portable-x86_64.zip.sha256.txt
|
2021-10-06 17:16:52 +00:00
|
|
|
- name: Upload artifacts to Github Releases (if master)
|
|
|
|
if: ${{ github.ref == 'refs/heads/master' }}
|
2021-10-03 13:13:32 +00:00
|
|
|
run: |
|
2021-10-03 15:27:14 +00:00
|
|
|
gh release upload ${{ needs.extract-version.outputs.espanso_version }} target/windows/installer/Espanso-Win-Installer-x86_64.exe target/windows/Espanso-Win-Portable-x86_64.zip target/windows/installer/Espanso-Win-Installer-x86_64.exe.sha256.txt target/windows/Espanso-Win-Portable-x86_64.zip.sha256.txt
|
|
|
|
|
|
|
|
linux-x11:
|
2021-10-04 18:42:38 +00:00
|
|
|
needs: ["extract-version", "create-release"]
|
2021-10-03 15:27:14 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Print target version
|
|
|
|
run: |
|
|
|
|
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
|
|
|
|
- name: Build docker image
|
|
|
|
run: |
|
|
|
|
sudo docker build -t espanso-ubuntu . -f .github/scripts/ubuntu/Dockerfile
|
|
|
|
- name: Build AppImage
|
|
|
|
run: |
|
|
|
|
sudo docker run --rm -v "$(pwd):/shared" espanso-ubuntu espanso/.github/scripts/ubuntu/build_appimage.sh
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
name: "Upload artifacts"
|
|
|
|
with:
|
2021-10-03 16:29:10 +00:00
|
|
|
name: Linux X11 Artifacts
|
2021-10-03 15:27:14 +00:00
|
|
|
path: |
|
2021-10-03 16:29:10 +00:00
|
|
|
Espanso-X11.AppImage
|
|
|
|
Espanso-X11.AppImage.sha256.txt
|
2021-10-06 17:16:52 +00:00
|
|
|
- name: Upload artifacts to Github Releases (if master)
|
|
|
|
if: ${{ github.ref == 'refs/heads/master' }}
|
2021-10-03 15:27:14 +00:00
|
|
|
run: |
|
2021-10-03 16:29:10 +00:00
|
|
|
gh release upload ${{ needs.extract-version.outputs.espanso_version }} Espanso-X11.AppImage Espanso-X11.AppImage.sha256.txt
|
2022-01-10 19:53:56 +00:00
|
|
|
|
|
|
|
linux-deb:
|
|
|
|
needs: ["extract-version", "create-release"]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Print target version
|
|
|
|
run: |
|
|
|
|
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
|
|
|
|
- name: Build docker image
|
|
|
|
run: |
|
|
|
|
sudo docker build -t espanso-ubuntu . -f .github/scripts/ubuntu/Dockerfile
|
2022-01-10 20:04:20 +00:00
|
|
|
- name: Build Deb packages
|
2022-01-10 19:53:56 +00:00
|
|
|
run: |
|
|
|
|
sudo docker run --rm -v "$(pwd):/shared" espanso-ubuntu espanso/.github/scripts/ubuntu/build_deb.sh
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
name: "Upload artifacts"
|
|
|
|
with:
|
2022-01-10 20:42:45 +00:00
|
|
|
name: Ubuntu-Debian Artifacts
|
2022-01-10 19:53:56 +00:00
|
|
|
path: |
|
|
|
|
espanso-debian-x11-amd64.deb
|
|
|
|
espanso-debian-wayland-amd64.deb
|
|
|
|
- name: Upload artifacts to Github Releases (if master)
|
|
|
|
if: ${{ github.ref == 'refs/heads/master' }}
|
|
|
|
run: |
|
|
|
|
gh release upload ${{ needs.extract-version.outputs.espanso_version }} espanso-debian-x11-amd64.deb espanso-debian-wayland-amd64.deb espanso-debian-x11-amd64-sha256.txt espanso-debian-wayland-amd64-sha256.txt
|
|
|
|
|
2021-10-04 12:25:57 +00:00
|
|
|
|
|
|
|
macos-intel:
|
2021-10-04 18:42:38 +00:00
|
|
|
needs: ["extract-version", "create-release"]
|
2021-10-04 12:56:58 +00:00
|
|
|
runs-on: macos-11
|
2021-10-04 12:25:57 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Print target version
|
|
|
|
run: |
|
|
|
|
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
|
2021-12-11 15:31:57 +00:00
|
|
|
- name: Install rust-script and cargo-make
|
2021-10-04 12:25:57 +00:00
|
|
|
run: |
|
2021-12-11 15:31:57 +00:00
|
|
|
cargo install rust-script --version "0.7.0"
|
2021-10-22 19:18:28 +00:00
|
|
|
cargo install --force cargo-make --version 0.34.0
|
2021-10-04 12:25:57 +00:00
|
|
|
- name: Test
|
|
|
|
run: cargo make test-binary --profile release
|
2021-10-14 17:37:47 +00:00
|
|
|
env:
|
|
|
|
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
2021-10-04 12:25:57 +00:00
|
|
|
- name: Build
|
|
|
|
run: cargo make create-bundle --profile release
|
2021-10-14 17:37:47 +00:00
|
|
|
env:
|
|
|
|
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
2021-10-04 12:25:57 +00:00
|
|
|
- name: Create ZIP archive
|
|
|
|
run: |
|
|
|
|
ditto -c -k --sequesterRsrc --keepParent target/mac/Espanso.app Espanso-Mac-Intel.zip
|
|
|
|
- name: Calculate hashes
|
|
|
|
run: |
|
|
|
|
shasum -a 256 Espanso-Mac-Intel.zip > Espanso-Mac-Intel.zip.sha256.txt
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
name: "Upload artifacts"
|
|
|
|
with:
|
|
|
|
name: Mac Intel Artifacts
|
|
|
|
path: |
|
|
|
|
Espanso-Mac-Intel.zip
|
|
|
|
Espanso-Mac-Intel.zip.sha256.txt
|
2021-10-06 17:16:52 +00:00
|
|
|
- name: Upload artifacts to Github Releases (if master)
|
|
|
|
if: ${{ github.ref == 'refs/heads/master' }}
|
2021-10-04 12:25:57 +00:00
|
|
|
run: |
|
|
|
|
gh release upload ${{ needs.extract-version.outputs.espanso_version }} Espanso-Mac-Intel.zip Espanso-Mac-Intel.zip.sha256.txt
|
2021-10-04 12:56:58 +00:00
|
|
|
|
|
|
|
macos-m1:
|
2021-10-04 18:42:38 +00:00
|
|
|
needs: ["extract-version", "create-release"]
|
2021-10-04 12:56:58 +00:00
|
|
|
runs-on: macos-11
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Print target version
|
|
|
|
run: |
|
|
|
|
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
|
2021-10-04 13:31:05 +00:00
|
|
|
- name: Install rust target
|
|
|
|
run: rustup update && rustup target add aarch64-apple-darwin
|
2021-12-11 15:31:57 +00:00
|
|
|
- name: Install rust-script and cargo-make
|
2021-10-04 12:56:58 +00:00
|
|
|
run: |
|
2021-12-11 15:31:57 +00:00
|
|
|
cargo install rust-script --version "0.7.0"
|
2021-10-22 19:18:28 +00:00
|
|
|
cargo install --force cargo-make --version 0.34.0
|
2021-10-04 12:56:58 +00:00
|
|
|
- name: Build
|
|
|
|
run: cargo make create-bundle --profile release --env BUILD_ARCH=aarch64-apple-darwin
|
|
|
|
- name: Codesign executable
|
|
|
|
env:
|
|
|
|
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
|
|
|
|
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
|
|
|
|
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.MACOS_CI_KEYCHAIN_PWD }}
|
|
|
|
run: |
|
2021-10-04 16:13:56 +00:00
|
|
|
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
|
2021-10-04 17:03:09 +00:00
|
|
|
security create-keychain -p $MACOS_CI_KEYCHAIN_PWD buildespanso.keychain
|
|
|
|
security default-keychain -s buildespanso.keychain
|
|
|
|
security unlock-keychain -p $MACOS_CI_KEYCHAIN_PWD buildespanso.keychain
|
|
|
|
security import certificate.p12 -k buildespanso.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
|
|
|
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_CI_KEYCHAIN_PWD buildespanso.keychain
|
2021-10-04 12:56:58 +00:00
|
|
|
/usr/bin/codesign --force -s "Espanso CI Self-Signed" target/mac/Espanso.app -v
|
|
|
|
- name: Create ZIP archive
|
|
|
|
run: |
|
|
|
|
ditto -c -k --sequesterRsrc --keepParent target/mac/Espanso.app Espanso-Mac-M1.zip
|
|
|
|
- name: Calculate hashes
|
|
|
|
run: |
|
|
|
|
shasum -a 256 Espanso-Mac-M1.zip > Espanso-Mac-M1.zip.sha256.txt
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
name: "Upload artifacts"
|
|
|
|
with:
|
|
|
|
name: Mac M1 Artifacts
|
|
|
|
path: |
|
|
|
|
Espanso-Mac-M1.zip
|
|
|
|
Espanso-Mac-M1.zip.sha256.txt
|
2021-10-06 17:16:52 +00:00
|
|
|
- name: Upload artifacts to Github Releases (if master)
|
|
|
|
if: ${{ github.ref == 'refs/heads/master' }}
|
2021-10-04 12:56:58 +00:00
|
|
|
run: |
|
2022-01-12 20:40:47 +00:00
|
|
|
gh release upload ${{ needs.extract-version.outputs.espanso_version }} Espanso-Mac-M1.zip Espanso-Mac-M1.zip.sha256.txt
|
|
|
|
|
|
|
|
macos-publish-homebrew:
|
2022-01-12 20:46:06 +00:00
|
|
|
needs: ["extract-version", "create-release", "macos-m1", "macos-intel"]
|
2022-01-12 20:40:47 +00:00
|
|
|
runs-on: macos-11
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Print target version
|
|
|
|
run: |
|
|
|
|
echo Using version ${{ needs.extract-version.outputs.espanso_version }}
|
|
|
|
|
|
|
|
- name: "Setup SSH deploy key"
|
|
|
|
uses: webfactory/ssh-agent@fc49353b67b2b7c1e0e6a600572d01a69f2672dd
|
2022-01-12 20:42:24 +00:00
|
|
|
with:
|
|
|
|
ssh-private-key: ${{ secrets.HOMEBREW_CASK_SSH_PRIVATE_KEY }}
|
2022-01-12 20:46:06 +00:00
|
|
|
|
2022-01-12 20:40:47 +00:00
|
|
|
- name: Create and Publish Homebrew Cask
|
2022-01-12 20:46:06 +00:00
|
|
|
if: ${{ github.ref == 'refs/heads/master' }}
|
2022-01-12 20:40:47 +00:00
|
|
|
run: |
|
2022-01-12 20:46:06 +00:00
|
|
|
VERSION="${{ needs.extract-version.outputs.espanso_version }}" ./scripts/publish_homebrew_version.sh
|
2022-01-12 20:40:47 +00:00
|
|
|
|
|
|
|
echo "Cask formula has been published here: "
|