fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
a3b009dd4
master
1name : Create a new release 2 3on : 4workflow_dispatch : 5inputs : 6version : 7description : 'Version to release (tag name)' 8required : true 9type : string 10 11permissions : 12contents : write 13 14jobs : 15is-release-tag : 16name : Pre-release checks 17runs-on : ubuntu-latest 18steps : 19- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, build_tools/update-dependencies.sh 20with : 21# Workaround for https://github.com/actions/checkout/issues/882 22ref : ${{ inputs.version }} 23- name : Check if the pushed tag looks like a release 24run : | 25set -x 26commit_subject=$(git log -1 --format=%s) 27tag=$(git describe) 28[ "$commit_subject" = "Release $tag" ] 29 30 31source-tarball : 32needs : [ is-release-tag ] 33name : Create the source tarball 34runs-on : ubuntu-latest 35outputs : 36version : ${{ steps.version.outputs.version }} 37tarball-name : ${{ steps.version.outputs.tarball-name }} 38steps : 39- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, build_tools/update-dependencies.sh 40with : 41# Workaround for https://github.com/actions/checkout/issues/882 42ref : ${{ inputs.version }} 43- name : Update package database 44run : sudo apt-get update 45- name : Install dependencies 46run : sudo apt install cmake gettext ninja-build python3-pip 47- uses : ./.github/actions/install-sphinx 48- name : Create tarball 49run : | 50set -x 51mkdir /tmp/fish-built 52FISH_ARTEFACT_PATH=/tmp/fish-built ./build_tools/make_tarball.sh 53relnotes=/tmp/fish-built/release-notes.md 54# Need history since the last release (i.e. tag) for stats. 55git fetch --tags 56git fetch --unshallow 57gpg_public_key_url=https://github.com/${{ github.actor }}.gpg 58curl -sS "$gpg_public_key_url" | grep 'PGP PUBLIC KEY BLOCK' -A5 59FISH_GPG_PUBLIC_KEY_URL=$gpg_public_key_url \ 60sh -x ./build_tools/release-notes.sh >"$relnotes" 61# Delete title 62sed -n 1p "$relnotes" | grep -q "^## fish .*" 63sed -n 2p "$relnotes" | grep -q '^$' 64sed -i 1,2d "$relnotes" 65- name : Upload tarball artifact 66uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1, build_tools/update-dependencies.sh 67with : 68name : source-tarball 69path : | 70/tmp/fish-built/fish-${{ inputs.version }}.tar.xz 71/tmp/fish-built/release-notes.md 72if-no-files-found : error 73 74packages-for-linux : 75needs : [ is-release-tag ] 76name : Build single-file fish for Linux 77runs-on : ubuntu-latest 78steps : 79- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, build_tools/update-dependencies.sh 80with : 81# Workaround for https://github.com/actions/checkout/issues/882 82ref : ${{ inputs.version }} 83- name : Install Rust Stable 84uses : ./.github/actions/rust-toolchain@stable 85with : 86targets : x86_64-unknown-linux-musl,aarch64-unknown-linux-musl 87- name : Update package database 88run : sudo apt-get update 89- name : Install dependencies 90run : sudo apt install crossbuild-essential-arm64 gettext musl-tools 91- uses : ./.github/actions/install-sphinx 92- name : Build statically-linked executables 93run : | 94set -x 95cargo build --release --target x86_64-unknown-linux-musl --bin fish 96CFLAGS="-D_FORTIFY_SOURCE=2" \ 97CC=aarch64-linux-gnu-gcc \ 98RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc -C link-arg=-lgcc -C link-arg=-D_FORTIFY_SOURCE=0" \ 99cargo build --release --target aarch64-unknown-linux-musl --bin fish 100- name : Compress 101run : | 102set -x 103for arch in x86_64 aarch64; do 104tar -cazf fish-$(git describe)-linux-$arch.tar.xz \ 105-C target/$arch-unknown-linux-musl/release fish 106done 107- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1, build_tools/update-dependencies.sh 108with : 109name : Static builds for Linux 110path : fish-${{ inputs.version }}-linux-*.tar.xz 111if-no-files-found : error 112 113create-draft-release : 114needs : 115- is-release-tag 116- source-tarball 117- packages-for-linux 118name : Create release draft 119runs-on : ubuntu-latest 120steps : 121- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, build_tools/update-dependencies.sh 122with : 123# Workaround for https://github.com/actions/checkout/issues/882 124ref : ${{ inputs.version }} 125- name : Download all artifacts 126uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1, build_tools/update-dependencies.sh 127with : 128merge-multiple : true 129path : /tmp/artifacts 130- name : List artifacts 131run : find /tmp/artifacts -type f 132- name : Create draft release 133uses : softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0, build_tools/update-dependencies.sh 134with : 135tag_name : ${{ inputs.version }} 136name : fish ${{ inputs.version }} 137body_path : /tmp/artifacts/release-notes.md 138draft : true 139files : | 140/tmp/artifacts/fish-${{ inputs.version }}.tar.xz 141/tmp/artifacts/fish-${{ inputs.version }}-linux-*.tar.xz 142 143packages-for-macos : 144needs : [ is-release-tag , create-draft-release ] 145name : Build packages for macOS 146runs-on : macos-latest 147environment : macos-codesign 148steps : 149- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, build_tools/update-dependencies.sh 150with : 151# Workaround for https://github.com/actions/checkout/issues/882 152ref : ${{ inputs.version }} 153- name : Install Rust 154uses : ./.github/actions/rust-toolchain@stable 155with : 156targets : aarch64-apple-darwin,x86_64-apple-darwin 157- name : Install dependencies 158run : brew install gettext 159- uses : ./.github/actions/install-sphinx 160- name : Build and codesign 161run : | 162die() { echo >&2 "$*"; exit 1; } 163[ -n "$MAC_CODESIGN_APP_P12_BASE64" ] || die "Missing MAC_CODESIGN_APP_P12_BASE64" 164[ -n "$MAC_CODESIGN_INSTALLER_P12_BASE64" ] || die "Missing MAC_CODESIGN_INSTALLER_P12_BASE64" 165[ -n "$MAC_CODESIGN_PASSWORD" ] || die "Missing MAC_CODESIGN_PASSWORD" 166[ -n "$MACOS_NOTARIZE_JSON" ] || die "Missing MACOS_NOTARIZE_JSON" 167set -x 168export FISH_ARTEFACT_PATH=/tmp/fish-built 169# macOS runners keep having issues loading Cargo.toml dependencies from git (GitHub) instead 170# of crates.io, so give this a try. It's also sometimes significantly faster on all platforms. 171export CARGO_NET_GIT_FETCH_WITH_CLI=true 172cargo install apple-codesign 173mkdir -p "$FISH_ARTEFACT_PATH" 174echo "$MAC_CODESIGN_APP_P12_BASE64" | base64 --decode >/tmp/app.p12 175echo "$MAC_CODESIGN_INSTALLER_P12_BASE64" | base64 --decode >/tmp/installer.p12 176echo "$MACOS_NOTARIZE_JSON" >/tmp/notarize.json 177./build_tools/make_macos_pkg.sh -s -f /tmp/app.p12 \ 178-i /tmp/installer.p12 -p "$MAC_CODESIGN_PASSWORD" \ 179-n -j /tmp/notarize.json -- -c "-DWITH_DOCS=ON" 180version=$(git describe) 181[ -f "${FISH_ARTEFACT_PATH}/fish-$version.app.zip" ] 182[ -f "${FISH_ARTEFACT_PATH}/fish-$version.pkg" ] 183rm /tmp/installer.p12 /tmp/app.p12 /tmp/notarize.json 184env : 185MAC_CODESIGN_APP_P12_BASE64 : ${{ secrets.MAC_CODESIGN_APP_P12_BASE64 }} 186MAC_CODESIGN_INSTALLER_P12_BASE64 : ${{ secrets.MAC_CODESIGN_INSTALLER_P12_BASE64 }} 187MAC_CODESIGN_PASSWORD : ${{ secrets.MAC_CODESIGN_PASSWORD }} 188MACOS_NOTARIZE_JSON : ${{ secrets.MACOS_NOTARIZE_JSON }} 189- name : Add macOS packages to the release 190env : 191GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} 192run : | 193 version=$(git describe) 194 gh release upload $version \ 195 /tmp/fish-built/fish-$version.app.zip \ 196 /tmp/fish-built/fish-$version.pkg