-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- π§Ή Move migrations to runtime for binaries. - β¨ Add install script for Mac and linux binaries. - π Use "cross" to test and build binaries in the pipeline. - π Use "dunce" to support windows absolute paths. - π§ͺ Update tests. - π§ (WIP) homebrew template
- Loading branch information
Showing
16 changed files
with
774 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: π¦ Cargo Publish | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
required: false | ||
type: string | ||
|
||
dry-run: | ||
required: true | ||
type: boolean | ||
default: true | ||
|
||
jobs: | ||
dry-run: | ||
if: inputs.dry-run | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Cargo toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Cargo build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
|
||
- name: Cargo publish dry-run | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: publish | ||
args: --dry-run | ||
|
||
publish: | ||
if: inputs.dry-run != true | ||
runs-on: ubuntu-latest | ||
env: | ||
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Cargo toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Cargo release build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
# Allows us to use the git tag version as the package version | ||
command: install | ||
args: cargo-release | ||
|
||
- name: Update Cargo.toml version | ||
run: | | ||
cargo release version ${{ inputs.version }} --no-confirm --execute | ||
# Publish and allow dirty since the Cargo.toml version is changed. | ||
- name: Publish package | ||
run: cargo publish --token "$CARGO_TOKEN" --allow-dirty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,159 @@ | ||
name: π Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
- "[0-9]+.[0-9]+.[0-9]+-pre[0-9]+" | ||
|
||
name: Release and publish | ||
env: | ||
BIN_NAME: git-kit | ||
|
||
jobs: | ||
build: | ||
github-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- uses: actions-rs/cargo@v1 | ||
- name: Environment variables | ||
run: | | ||
echo "TAG=$(echo $GITHUB_REF | cut -d '/' -f 3)" >> $GITHUB_ENV | ||
echo "version is: ${{ env.TAG }}" | ||
- name: Create GitHub release | ||
id: release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
command: build | ||
tag_name: ${{ env.TAG }} | ||
release_name: ${{ env.TAG }} | ||
outputs: | ||
upload_url: ${{ steps.release.outputs.upload_url }} | ||
version: ${{ env.TAG }} | ||
|
||
cargo: | ||
needs: ["github-release"] | ||
uses: xsv24/git-kit/.github/workflows/cargo-publish.yml@binary-relase | ||
with: | ||
version: ${{ needs.github-release.version }} | ||
dry-run: false | ||
|
||
build: | ||
name: Build | ||
runs-on: ${{ matrix.os }} | ||
needs: ["github-release"] | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
build: [ | ||
linux-x86, | ||
linux-i686, | ||
linux-aarch64, | ||
linux-arm, | ||
macos-x86, | ||
macos-arm, | ||
win-msvc, | ||
win32-msvc, | ||
# win-gnu, | ||
] | ||
# List of OS versions https://github.com/actions/runner-images | ||
include: | ||
- build: linux-x86 | ||
os: ubuntu-22.04 | ||
target: x86_64-unknown-linux-musl | ||
|
||
- build: linux-i686 | ||
os: ubuntu-22.04 | ||
target: i686-unknown-linux-musl | ||
|
||
- build: linux-aarch64 | ||
os: ubuntu-22.04 | ||
target: aarch64-unknown-linux-musl | ||
|
||
- build: linux-arm | ||
os: ubuntu-22.04 | ||
target: arm-unknown-linux-gnueabihf | ||
|
||
- build: | ||
os: ubuntu-22.04 | ||
target: x86_64-unknown-freebsd | ||
|
||
- build: macos-x86 | ||
os: macos-12 | ||
target: x86_64-apple-darwin | ||
|
||
- build: macos-arm | ||
os: macos-12 | ||
target: aarch64-apple-darwin | ||
|
||
- build: win-msvc | ||
os: windows-2022 | ||
target: x86_64-pc-windows-msvc | ||
|
||
- build: win32-msvc | ||
os: windows-2022 | ||
target: i686-pc-windows-msvc | ||
|
||
# - build: win-gnu | ||
# os: windows-2022 | ||
# target: x86_64-pc-windows-gnu | ||
|
||
publish-dry: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install ${{ matrix.target }} toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
target: ${{ matrix.target }} | ||
override: true | ||
- uses: actions-rs/cargo@v1 | ||
|
||
- name: Build release binary | ||
uses: actions-rs/cargo@v1 | ||
env: | ||
BUILD_DISABLED: "true" # Disable the "build.rs" file from running | ||
with: | ||
command: publish | ||
args: --dry-run | ||
use-cross: true | ||
command: build | ||
args: --verbose --release --target=${{ matrix.target }} | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
env: | ||
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
- name: Strip release binary (linux-x86 and macos) | ||
if: matrix.build == 'linux-x86' || matrix.build == 'macos-x86' || matrix.build == 'macos-arm' | ||
run: strip "target/${{ matrix.target }}/release/$BIN_NAME" | ||
|
||
- name: Strip release binary (linux-arm) | ||
if: matrix.build == 'linux-arm' | ||
run: | | ||
sudo apt-get install -y binutils-arm-linux-gnueabihf | ||
arm-linux-gnueabihf-strip target/arm-unknown-linux-gnueabihf/release/$BIN_NAME | ||
- name: Build archive | ||
shell: bash | ||
run: | | ||
compressed="git-kit-${{ matrix.target }}" | ||
mkdir $compressed | ||
cp {README.md,LICENSE,templates/conventional.yml,templates/default.yml} "$compressed/" | ||
if [ "${{ matrix.os }}" = "windows-2022" ]; then | ||
cp "target/${{ matrix.target }}/release/$BIN_NAME.exe" "$compressed/" | ||
7z a "$compressed.zip" "$compressed" | ||
echo "ASSET=$compressed.zip" >> $GITHUB_ENV | ||
else | ||
cp "target/${{ matrix.target }}/release/$BIN_NAME" "$compressed/" | ||
tar czf "$compressed.tar.gz" "$compressed" | ||
echo "ASSET=$compressed.tar.gz" >> $GITHUB_ENV | ||
fi | ||
- uses: actions/[email protected] | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- uses: actions-rs/cargo@v1 | ||
name: bins-${{ matrix.build }} | ||
path: ${{ env.ASSET }} | ||
|
||
- name: Upload release archive | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
# Allows us to use the git tag version as the package version | ||
command: install | ||
args: cargo-release | ||
- name: Update Cargo.toml version | ||
run: | | ||
TAG_VERSION=$(echo $GITHUB_REF | cut -d '/' -f 3) | ||
cargo release version "$TAG_VERSION" --no-confirm --execute | ||
# Publish and allow dirty since the Cargo.toml version is changed. | ||
- name: Publish package | ||
run: cargo publish --token "$CARGO_TOKEN" --allow-dirty | ||
needs: [build, publish-dry] | ||
upload_url: ${{ needs.github-release.outputs.upload_url }} | ||
asset_path: ${{ env.ASSET }} | ||
asset_name: ${{ env.ASSET }} | ||
asset_content_type: application/octet-stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[build.env] | ||
passthrough = [ | ||
"BUILD_DISABLED", | ||
"RUST_LOG" | ||
] |
Oops, something went wrong.