2
0
mirror of https://github.com/xvxx/phetch synced 2024-11-15 00:12:50 +00:00
phetch/.github/workflows/release.yml

163 lines
5.7 KiB
YAML
Raw Normal View History

2020-01-28 02:36:41 +00:00
name: Create Release
on:
push:
tags:
2020-05-17 17:10:00 +00:00
- "v*.*.*"
2020-01-28 02:36:41 +00:00
jobs:
build_armv7:
name: Build for armv7
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Setup Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: armv7-unknown-linux-gnueabihf
override: true
- name: Build release
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
2020-02-25 20:36:59 +00:00
args: --release --locked --target armv7-unknown-linux-gnueabihf
2020-01-28 02:36:41 +00:00
- name: Get current version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Package Binary
2020-02-25 20:24:30 +00:00
run: cp doc/phetch.1 target/armv7-unknown-linux-gnueabihf/release && cd target/armv7-unknown-linux-gnueabihf/release && tar zcvf phetch-${{ steps.get_version.outputs.VERSION }}-linux-armv7.tgz phetch phetch.1
2020-01-28 02:36:41 +00:00
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: phetch-linux-armv7
path: target/armv7-unknown-linux-gnueabihf/release/phetch-${{ steps.get_version.outputs.VERSION }}-linux-armv7.tgz
build_linux:
name: Build for Linux x86_64
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Build release
2020-02-25 20:36:59 +00:00
run: cargo build --locked --release
2020-01-28 02:36:41 +00:00
- name: Get current version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Package Binary
2020-02-25 20:24:30 +00:00
run: cp doc/phetch.1 target/release && cd target/release && tar zcvf phetch-${{ steps.get_version.outputs.VERSION }}-linux-x86_64.tgz phetch phetch.1
2020-01-28 02:36:41 +00:00
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: phetch-linux-x86_64
path: target/release/phetch-${{ steps.get_version.outputs.VERSION }}-linux-x86_64.tgz
build_macos:
name: Build for macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Setup Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build release
uses: actions-rs/cargo@v1
with:
command: build
2020-02-25 20:36:59 +00:00
args: --locked --release
2020-01-28 02:36:41 +00:00
- name: Get current version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Package Binary
2020-02-25 20:24:30 +00:00
run: cp doc/phetch.1 target/release && cd target/release && zip -r phetch-${{ steps.get_version.outputs.VERSION }}-macos.zip phetch phetch.1
2020-01-28 02:36:41 +00:00
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: phetch-macos
path: target/release/phetch-${{ steps.get_version.outputs.VERSION }}-macos.zip
create:
name: Create Release
needs: [build_armv7, build_linux, build_macos]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get current version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Download macOS artifact
uses: actions/download-artifact@v1
with:
name: phetch-macos
- name: Download Linux (x86_64) artifact
uses: actions/download-artifact@v1
with:
name: phetch-linux-x86_64
- name: Download Linux (armv7) artifact
uses: actions/download-artifact@v1
with:
name: phetch-linux-armv7
- name: Create Release
uses: softprops/action-gh-release@v1
with:
draft: true
2020-05-17 17:10:00 +00:00
prerelease: false
2020-01-28 02:36:41 +00:00
files: |
phetch-macos/phetch-${{ steps.get_version.outputs.VERSION }}-macos.zip
phetch-linux-x86_64/phetch-${{ steps.get_version.outputs.VERSION }}-linux-x86_64.tgz
2020-02-25 20:14:51 +00:00
phetch-linux-armv7/phetch-${{ steps.get_version.outputs.VERSION }}-linux-armv7.tgz
2020-01-28 02:36:41 +00:00
body_path: CHANGELOG.md
env:
2020-05-17 17:10:00 +00:00
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}