Skip to content

vendor dependencies and add artifacts checksum #452

vendor dependencies and add artifacts checksum

vendor dependencies and add artifacts checksum #452

Workflow file for this run

name: Release
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: nightly
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
pull_request:
paths:
# trigger release workflow only if this file changed
- .github/workflows/release.yml
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
tagname:
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.tag.outputs.tag }}
steps:
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- if: github.event_name == 'pull_request'
run: echo 'TAG_NAME=debug' >> $GITHUB_ENV
- id: vars
shell: bash
run: echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
- if: env.TAG_NAME == 'nightly'
run: echo 'TAG_NAME=nightly-${{ steps.vars.outputs.sha_short }}' >> $GITHUB_ENV
- id: tag
run: echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
windows:
runs-on: windows-latest
needs: tagname
env:
RELEASE_TAG_NAME: ${{ needs.tagname.outputs.tag_name }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Update rust
run: make rustup
- name: Fetch dependencies
run: make fetch
- name: Build
run: make build
- name: Install WiX
run: make windows-dependencies
- name: Crate msi installer
run: |
./WiX.*/tools/candle.exe -arch "x64" -ext WixUIExtension -ext WixUtilExtension \
-out "./lapce.wixobj" "extra/windows/wix/lapce.wxs"
./WiX.*/tools/light.exe -ext WixUIExtension -ext WixUtilExtension \
-out "./target/release-lto/windows/Lapce-windows.msi" -sice:ICE61 -sice:ICE91 \
"./lapce.wixobj"
- name: Create portable
shell: pwsh
run: |
cargo build --profile release-lto --features lapce-ui/portable
Compress-Archive ./target/release-lto/lapce.exe ./target/release-lto/windows/Lapce-windows-portable.zip
- name: Create lapce-proxy archive
shell: pwsh
run: |
$file = [System.IO.File]::Open((Join-Path $PWD '.\target\release-lto\lapce-proxy.exe'), [System.IO.FileMode]::Open)
$archive = [System.IO.File]::Create((Join-Path $PWD '.\target\release-lto\windows\lapce-proxy-windows-x86_64.gz'))
$compressor = [System.IO.Compression.GZipStream]::new($archive, [System.IO.Compression.CompressionMode]::Compress)
$file.CopyTo($compressor)
Start-Sleep -Seconds 10
$compressor.close()
- uses: actions/upload-artifact@v3
with:
name: lapce-windows
path: |
./target/release-lto/windows/lapce-proxy-windows-*.gz
./target/release-lto/windows/Lapce-windows-portable.zip
./target/release-lto/windows/Lapce-windows.msi
retention-days: 1
linux:
runs-on: ubuntu-latest
container: ubuntu:18.04
needs: tagname
env:
RELEASE_TAG_NAME: ${{ needs.tagname.outputs.tag_name }}
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v3
- name: Install make
run: |
apt-get -y update
apt-get -y install make git
- run: echo "RELEASE_DIR=$(make release-dir)" >> $GITHUB_ENV
- name: Install dependencies
run: make ubuntu-dependencies
- name: Install Rust toolchain
run: |
make rustup
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Fetch dependencies
run: make fetch
- name: Vendor dependencies
run: make vendor
- name: Build
run: make build
- name: Gzip
run: make tarball
- name: Make debian package
run: make RELEASE_TAG_VERSION=${{ env.RELEASE_TAG_VERSION }} deb
- uses: actions/upload-artifact@v3
with:
name: lapce-linux
path: |
./${{ env.RELEASE_DIR }}/linux/lapce.deb
./${{ env.RELEASE_DIR }}/linux/Lapce-linux.tar.gz
./${{ env.RELEASE_DIR }}/vendor-*.tar.gz
retention-days: 1
linux-musl:
name: Build lapce-proxy for ${{ matrix.platform }}
runs-on: ubuntu-latest
needs: tagname
env:
RELEASE_TAG_NAME: ${{ needs.tagname.outputs.tag_name }}
CROSS_SYSROOT: /mnt/alpine-${{ matrix.platform }}
PACKAGES: >
zlib-static freetype-static fontconfig-static
libgit2-static libssh2-static openssl-libs-static
libssl3 gtk+3.0-dev http-parser-dev rustup
build-base openssl-dev git lld clang make
strategy:
fail-fast: false
matrix:
include:
- triple: x86_64-unknown-linux-musl
platform: x86_64
- triple: aarch64-unknown-linux-musl
platform: aarch64
steps:
- uses: actions/checkout@v3
- run: echo "RELEASE_DIR=$(make release-dir)" >> $GITHUB_ENV
- name: Set up Alpine Linux for ${{ matrix.platform }} (target arch)
id: alpine-target
uses: jirutka/setup-alpine@v1
with:
arch: ${{ matrix.platform }}
branch: edge
packages: ${{ env.PACKAGES }}
shell-name: alpine-target.sh
- name: Set up Alpine Linux for x86_64 (build arch)
uses: jirutka/setup-alpine@v1
with:
arch: x86_64
branch: edge
packages: ${{ env.PACKAGES }}
volumes: ${{ steps.alpine-target.outputs.root-path }}:${{ env.CROSS_SYSROOT }}
shell-name: alpine.sh
- name: Install Rust stable toolchain via rustup
shell: alpine.sh {0}
run: rustup-init --target ${{ matrix.triple }} --default-toolchain stable --profile minimal -y
- name: Fetch dependencies
run: make fetch
- name: Build ${{ matrix.triple }}
shell: alpine.sh {0}
env:
LIBZ_SYS_STATIC: 1
LIBSSH2_STATIC: 1
LIBGIT2_STATIC: 1
OPENSSL_STATIC: 1
OPENSSL_DIR: ${{ env.CROSS_SYSROOT }}/usr # static/dynamic lib workaround <3
OPENSSL_NO_VENDOR: 1 # don't even try to build without it on musl
PKG_CONFIG_ALL_STATIC: 1
PKG_CONFIG_LIBDIR: ${{ env.CROSS_SYSROOT }}/usr/lib/pkgconfig
RUSTFLAGS: -C target-feature=+crt-static -C linker=/usr/bin/ld.lld # link runtime static, use universal linker
CARGO_BUILD_TARGET: ${{ matrix.triple }}
CARGO_PROFILE_RELEASE_LTO: 'true'
CARGO_PROFILE_RELEASE_STRIP: symbols # remove unneeded debug stuff
CARGO_PROFILE_RELEASE_OPT_LEVEL: 's' # optimise for size
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: '1' # optimise each crate
SYSROOT: /dummy # workaround for https://github.com/rust-lang/pkg-config-rs/issues/102
CC: clang
run: |
# Workaround for https://github.com/rust-lang/pkg-config-rs/issues/102
echo -e '#!/bin/sh\nPKG_CONFIG_SYSROOT_DIR=${{ env.CROSS_SYSROOT }} exec pkgconf "$@"' \
| install -m755 /dev/stdin pkg-config
export PKG_CONFIG="$(pwd)/pkg-config"
cargo build \
--frozen \
--verbose \
--release \
--bin lapce-proxy \
--manifest-path lapce-proxy/Cargo.toml
- uses: actions/upload-artifact@v3
with:
name: lapce-proxy-linux-${{ matrix.platform }}
path: |
./${{ env.RELEASE_DIR }}/linux/lapce-proxy-linux-*.gz
retention-days: 1
macos:
runs-on: macos-11
needs: tagname
env:
RELEASE_TAG_NAME: ${{ needs.tagname.outputs.tag_name }}
NOTARIZE_USERNAME: ${{ secrets.NOTARIZE_USERNAME }}
NOTARIZE_PASSWORD: ${{ secrets.NOTARIZE_PASSWORD }}
DMG_NAME: Lapce-macos.dmg
steps:
- uses: actions/checkout@v3
- name: Source release directory
run: echo "RELEASE_DIR=$(make release-dir)" >> $GITHUB_ENV
- name: Install ARM target
run: make rustup && rustup target add aarch64-apple-darwin
- name: Import Certificate
uses: lapce/import-codesign-certs@72dec84923586f8bef2bed09fdb4f9475c8f623d # use updated action, can be dropped once/if upstream is fixed
with:
p12-file-base64: ${{ secrets.MACOS_CERTIFICATE }}
p12-password: ${{ secrets.MACOS_CERTIFICATE_PWD }}
- name: Fetch dependencies
run: make fetch
- name: Make DMG
run: make dmg-universal
- name: Gzip lapce-proxy
run: |
make CARGO_BUILD_TARGET=x86_64-apple-darwin gz
make CARGO_BUILD_TARGET=aarch64-apple-darwin gz
- name: "Notarize Release Build"
run: |
npx notarize-cli --file ./${{ env.RELEASE_DIR }}/${{ env.DMG_NAME }} --bundle-id io.lapce --asc-provider CYSGAZFR8D
- name: "Staple Release Build"
uses: lapce/xcode-staple@062485d6eeafe841c18a412f012e80f49e23c517
with:
product-path: "./${{ env.RELEASE_DIR }}/macos/${{ env.DMG_NAME }}"
- uses: actions/upload-artifact@v3
with:
name: lapce-macos
path: |
./${{ env.RELEASE_DIR }}/macos/lapce-proxy-darwin-*.gz
./${{ env.RELEASE_DIR }}/macos/${{ env.DMG_NAME }}
retention-days: 1
publish:
needs: [linux, linux-musl, windows, macos]
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
# Must perform checkout first, since it deletes the target directory
# before running, and would therefore delete the downloaded artifacts
- uses: actions/checkout@v3
- name: Source release directory
run: echo "RELEASE_DIR=$(make release-dir)" >> $GITHUB_ENV
- uses: actions/download-artifact@v3
with:
path: ${{ env.RELEASE_DIR }}
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- if: github.event_name == 'pull_request'
run: |
{
echo 'TAG_NAME='
echo 'SUBJECT=Lapce CI test build'
echo 'PRERELEASE=--prerelease'
echo 'DRAFT=--draft'
} >> $GITHUB_ENV
- if: env.TAG_NAME == 'nightly' && github.event_name != 'pull_request'
run: |
{
echo 'SUBJECT=Lapce development build'
echo 'PRERELEASE=--prerelease'
echo 'DRAFT='
} >> $GITHUB_ENV
gh release delete nightly --yes || true
git push origin :nightly || true
- if: env.TAG_NAME != 'nightly' && github.event_name != 'pull_request'
run: |
{
echo 'SUBJECT=Lapce release build'
echo 'PRERELEASE='
echo 'DRAFT='
} >> $GITHUB_ENV
- name: Publish release
env:
DEBUG: api
run: |
sha512sum ${{ env.RELEASE_DIR }}/*/* > ${{ env.RELEASE_DIR }}/checksums.sha512
gh release create \
$DRAFT \
$TAG_NAME \
$PRERELEASE \
--title "$TAG_NAME" \
--target $GITHUB_SHA \
${{ env.RELEASE_DIR }}/*/* \
${{ env.RELEASE_DIR }}/checksums.sha512