2020-04-13 11:23:55 +03:00
|
|
|
name: CD
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2020-04-14 12:43:12 +03:00
|
|
|
tags:
|
|
|
|
- '*'
|
2020-04-13 11:23:55 +03:00
|
|
|
|
|
|
|
jobs:
|
2020-04-15 17:36:40 +03:00
|
|
|
release:
|
|
|
|
strategy:
|
2020-08-29 19:50:19 +03:00
|
|
|
fail-fast: false
|
2020-04-15 17:36:40 +03:00
|
|
|
matrix:
|
2022-11-05 18:46:11 +03:00
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-22.04]
|
2020-04-15 17:36:40 +03:00
|
|
|
runs-on: ${{ matrix.os }}
|
2022-11-05 18:46:11 +03:00
|
|
|
|
2020-04-13 11:23:55 +03:00
|
|
|
steps:
|
2023-08-30 10:53:20 +03:00
|
|
|
- uses: actions/checkout@v3
|
2020-07-30 00:00:10 +03:00
|
|
|
|
2020-04-14 12:57:14 +03:00
|
|
|
- name: Get version
|
|
|
|
id: get_version
|
2023-09-09 12:20:19 +03:00
|
|
|
run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
|
2020-06-06 20:24:48 +03:00
|
|
|
|
2023-08-30 10:53:20 +03:00
|
|
|
- name: Restore cargo cache
|
|
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
env:
|
|
|
|
cache-name: ci
|
|
|
|
with:
|
|
|
|
shared-key: ${{ matrix.os }}-${{ env.cache-name }}-stable
|
|
|
|
|
2020-06-06 20:24:48 +03:00
|
|
|
- name: Install Rust
|
2023-08-30 10:53:20 +03:00
|
|
|
uses: dtolnay/rust-toolchain@stable
|
2020-06-06 20:24:48 +03:00
|
|
|
with:
|
|
|
|
components: clippy
|
|
|
|
|
2020-04-14 12:43:12 +03:00
|
|
|
- name: Build
|
2022-11-05 18:46:11 +03:00
|
|
|
if: matrix.os != 'ubuntu-22.04'
|
2020-04-14 12:43:12 +03:00
|
|
|
run: cargo build
|
|
|
|
- name: Run tests
|
2022-11-05 18:46:11 +03:00
|
|
|
if: matrix.os != 'ubuntu-22.04'
|
2020-04-14 12:43:12 +03:00
|
|
|
run: make test
|
|
|
|
- name: Run clippy
|
2022-11-05 18:46:11 +03:00
|
|
|
if: matrix.os != 'ubuntu-22.04'
|
2020-04-28 17:02:12 +03:00
|
|
|
run: |
|
2020-06-06 20:24:48 +03:00
|
|
|
cargo clean
|
2020-04-28 17:02:12 +03:00
|
|
|
make clippy
|
2020-04-16 14:03:55 +03:00
|
|
|
|
|
|
|
- name: Setup MUSL
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
run: |
|
|
|
|
rustup target add x86_64-unknown-linux-musl
|
|
|
|
sudo apt-get -qq install musl-tools
|
2020-06-16 22:45:08 +03:00
|
|
|
|
2022-11-05 18:46:11 +03:00
|
|
|
- name: Setup ARM toolchain
|
|
|
|
if: matrix.os == 'ubuntu-22.04'
|
|
|
|
run: |
|
|
|
|
rustup target add aarch64-unknown-linux-gnu
|
|
|
|
rustup target add armv7-unknown-linux-gnueabihf
|
|
|
|
rustup target add arm-unknown-linux-gnueabihf
|
|
|
|
|
|
|
|
curl -o $GITHUB_WORKSPACE/aarch64.tar.xz https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-a/8.2-2018.08/gcc-arm-8.2-2018.08-x86_64-aarch64-linux-gnu.tar.xz
|
|
|
|
curl -o $GITHUB_WORKSPACE/arm.tar.xz https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-a/8.2-2018.08/gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf.tar.xz
|
|
|
|
|
|
|
|
tar xf $GITHUB_WORKSPACE/aarch64.tar.xz
|
|
|
|
tar xf $GITHUB_WORKSPACE/arm.tar.xz
|
|
|
|
|
|
|
|
echo "$GITHUB_WORKSPACE/gcc-arm-8.2-2018.08-x86_64-aarch64-linux-gnu/bin" >> $GITHUB_PATH
|
|
|
|
echo "$GITHUB_WORKSPACE/gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf/bin" >> $GITHUB_PATH
|
|
|
|
|
2020-04-15 17:36:40 +03:00
|
|
|
- name: Build Release Mac
|
|
|
|
if: matrix.os == 'macos-latest'
|
|
|
|
run: make release-mac
|
|
|
|
- name: Build Release Linux
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2020-04-16 14:03:55 +03:00
|
|
|
run: make release-linux-musl
|
2020-04-28 12:28:59 +03:00
|
|
|
- name: Build Release Win
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
run: make release-win
|
2022-11-05 18:46:11 +03:00
|
|
|
- name: Build Release Linux ARM
|
|
|
|
if: matrix.os == 'ubuntu-22.04'
|
|
|
|
run: make release-linux-arm
|
2020-04-13 11:23:55 +03:00
|
|
|
|
2020-04-14 12:48:36 +03:00
|
|
|
- name: Set SHA
|
2020-04-15 17:36:40 +03:00
|
|
|
if: matrix.os == 'macos-latest'
|
2020-04-14 12:48:36 +03:00
|
|
|
id: shasum
|
|
|
|
run: |
|
2023-09-09 12:20:19 +03:00
|
|
|
echo sha="$(shasum -a 256 ./release/gitui-mac.tar.gz | awk '{printf $1}')" >> $GITHUB_OUTPUT
|
2020-04-14 12:48:36 +03:00
|
|
|
|
2020-05-13 18:17:49 +03:00
|
|
|
- name: Extract release notes
|
2020-05-16 21:35:42 +03:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2020-05-13 18:17:49 +03:00
|
|
|
id: release_notes
|
|
|
|
uses: ffurrer2/extract-release-notes@v1
|
2020-04-15 22:34:53 +03:00
|
|
|
- name: Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
2023-08-30 10:57:25 +03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2020-04-13 11:23:55 +03:00
|
|
|
with:
|
2020-05-13 18:17:49 +03:00
|
|
|
body: ${{ steps.release_notes.outputs.release_notes }}
|
2020-08-29 20:05:07 +03:00
|
|
|
prerelease: ${{ contains(github.ref, '-') }}
|
2020-04-15 22:34:53 +03:00
|
|
|
files: |
|
|
|
|
./release/*.tar.gz
|
2020-04-16 14:03:55 +03:00
|
|
|
./release/*.zip
|
2020-10-26 03:18:04 +03:00
|
|
|
./release/*.msi
|
2022-11-05 18:46:11 +03:00
|
|
|
|
2020-06-16 22:45:08 +03:00
|
|
|
- name: Bump homebrew-core formula
|
2023-08-27 17:36:29 +03:00
|
|
|
uses: mislav/bump-homebrew-formula-action@v2
|
2020-06-16 22:45:08 +03:00
|
|
|
if: "matrix.os == 'macos-latest' && !contains(github.ref, '-')" # skip prereleases
|
|
|
|
env:
|
|
|
|
COMMITTER_TOKEN: ${{ secrets.BREW_TOKEN }}
|
|
|
|
with:
|
|
|
|
formula-name: gitui
|
2023-08-30 17:23:35 +03:00
|
|
|
# https://github.com/mislav/bump-homebrew-formula-action/issues/58
|
|
|
|
formula-path: Formula/g/gitui.rb
|