gitui/.github/workflows/cd.yml

118 lines
3.7 KiB
YAML
Raw Normal View History

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:
os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-22.04]
2020-04-15 17:36:40 +03:00
runs-on: ${{ matrix.os }}
2020-04-13 11:23:55 +03:00
steps:
- uses: actions/checkout@v2
2020-04-14 12:57:14 +03:00
- name: Get version
id: get_version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
2020-06-06 20:24:48 +03:00
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
2020-06-06 20:24:48 +03:00
components: clippy
2020-04-14 12:43:12 +03:00
- name: Build
if: matrix.os != 'ubuntu-22.04'
2020-04-14 12:43:12 +03:00
run: cargo build
- name: Run tests
if: matrix.os != 'ubuntu-22.04'
2020-04-14 12:43:12 +03:00
run: make test
- name: Run clippy
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
- name: Setup MUSL
if: matrix.os == 'ubuntu-latest'
run: |
rustup target add x86_64-unknown-linux-musl
sudo apt-get -qq install musl-tools
- 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'
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
- 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: |
2020-04-15 17:36:40 +03:00
echo ::set-output name=sha::"$(shasum -a 256 ./release/gitui-mac.tar.gz | awk '{printf $1}')"
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
- name: Release
uses: softprops/action-gh-release@v1
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, '-') }}
files: |
./release/*.tar.gz
./release/*.zip
2020-10-26 03:18:04 +03:00
./release/*.msi
2020-04-13 11:23:55 +03:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2020-07-30 02:10:26 +03:00
# - name: Bump personal tap formula
# uses: mislav/bump-homebrew-formula-action@v1
# if: "matrix.os == 'macos-latest' && !contains(github.ref, '-')" # skip prereleases
# env:
# COMMITTER_TOKEN: ${{ secrets.BREW_TOKEN }}
# with:
# formula-name: gitui
# homebrew-tap: extrawurst/tap
# download-url: https://github.com/extrawurst/gitui/releases/download/${{ steps.get_version.outputs.version }}/gitui-mac.tar.gz
- name: Bump homebrew-core formula
uses: mislav/bump-homebrew-formula-action@v1
if: "matrix.os == 'macos-latest' && !contains(github.ref, '-')" # skip prereleases
env:
COMMITTER_TOKEN: ${{ secrets.BREW_TOKEN }}
with:
formula-name: gitui