Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mpwsh committed Nov 5, 2023
1 parent 8c7d0f3 commit 2aa7983
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 239 deletions.
221 changes: 0 additions & 221 deletions .github/workflows/build.yml

This file was deleted.

104 changes: 104 additions & 0 deletions .github/workflows/build2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Build and release binary
on:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
REPOSITORY: ${{ github.event.repository.name }}
BINARY_NAME: hub

jobs:
build:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
include:
- os: macos-latest
target: x86_64-apple-darwin
suffix: ''
- os: macos-latest-xlarge
target: aarch64-apple-darwin
suffix: ''
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
suffix: ''
- os: windows-latest
target: x86_64-pc-windows-msvc
suffix: .exe
steps:
- uses: actions/checkout@master
with:
lfs: true
- id: get_version
run: echo ::set-output "name=VERSION::$(IFS=\=;cat Cargo.toml | grep version | head -n1 | awk {'print $3'})"
shell: bash

- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: '${{ runner.os }}-${{ matrix.target }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: '${{ runner.os }}-${{ matrix.target }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
env:
VERSION: '${{ steps.get_version.outputs.VERSION }}'
with:
command: build
args: '--release'

- name: Rename binary
run: |
cp ./target/release/${{ env.BINARY_NAME }}${{matrix.suffix}} ./target/release/${{ env.REPOSITORY }}${{ matrix.suffix }}
- uses: actions/upload-artifact@v2
with:
name: ${{ env.REPOSITORY }}-${{ matrix.target }}
path: ./target/release/${{ env.REPOSITORY }}${{ matrix.suffix }}
if-no-files-found: error

release:
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
lfs: true
- uses: actions/download-artifact@v3

- name: Move binaries
run: |
mv ${{ env.REPOSITORY }}-x86_64-apple-darwin/${{ env.REPOSITORY }} byteme-x86_64-apple-darwin
mv ${{ env.REPOSITORY }}-x86_64-unknown-linux-gnu/${{ env.REPOSITORY }} byteme-x86_64-unknown-linux-gnu
mv ${{ env.REPOSITORY }}-x86_64-pc-windows-msvc/${{ env.REPOSITORY }}.exe byteme-x86_64-pc-windows.exe
mv ${{ env.REPOSITORY }}-aarch64-apple-darwin/${{ env.REPOSITORY }} byteme-aarch64-apple-darwin
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
with:
generate_release_notes: true
draft: true
fail_on_unmatched_files: true
files: |
byteme-x86_64-apple-darwin
byteme-x86_64-unknown-linux-gnu
byteme-x86_64-pc-windows.exe
byteme-aarch64-apple-darwin
18 changes: 0 additions & 18 deletions .github/workflows/tap.yml

This file was deleted.

0 comments on commit 2aa7983

Please sign in to comment.