Skip to content

Commit

Permalink
[ci] Add automatic release creation on tag push
Browse files Browse the repository at this point in the history
  • Loading branch information
svareille committed Sep 12, 2022
1 parent c08bbcb commit 09f8f39
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build_artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This file originaly comes from https://github.com/0x192/universal-android-debloater/blob/main/.github/workflows/build_artifacts.yml
name: Build artifacts
on:
workflow_dispatch:
workflow_call:

jobs:
build:
name: Building ${{ matrix.build_target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- build_target: linux
os: ubuntu-latest
- build_target: macos
os: macos-latest
- build_target: windows
os: windows-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
#- uses: rui314/setup-mold@v1 # faster linker
# with:
# make-default: false
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.OS }}-release-
if: matrix.os == 'ubuntu-latest'
- name: Building
run: cargo build --release
- name: Creating ./bin directory
run: mkdir -p bin
- name: Renaming binaries [Windows]
if: matrix.os == 'windows-latest'
run: mv target/release/okbr.exe bin/okbr-${{ matrix.build_target }}.exe
- name: Renaming binaries [Others]
if: matrix.os != 'windows-latest'
run: mv target/release/okbr bin/okbr-${{ matrix.build_target }}
- name: Tarball Linux binary
if: matrix.os == 'ubuntu-latest'
run: tar --remove-files -czf bin/okbr-${{ matrix.build_target }}{.tar.gz,}
- name: Zip MacOS binary
if: matrix.os == 'macos-latest'
run: zip -9rm bin/okbr-${{ matrix.build_target }}{.zip,}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: okbr-${{ matrix.build_target }}
path: bin/okbr-*
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and release

on:
push:
tags:
- '*.*.*'

jobs:
build:
uses: ./.github/workflows/build_artifacts.yml
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@master
- name: Downloads artifacts
uses: actions/download-artifact@v3
with:
path: bin
- name: Create draft release
uses: softprops/action-gh-release@v1
with:
files: bin/*/okbr-*
draft: true

0 comments on commit 09f8f39

Please sign in to comment.