Skip to content

Commit

Permalink
Merge pull request #2 from SergioGasquez/main
Browse files Browse the repository at this point in the history
Add CI to generate release packages
  • Loading branch information
bjoernQ authored May 26, 2022
2 parents 491ddd5 + 7f4b9f1 commit 946047a
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Package

on:
workflow_call:
inputs:
runs_on:
required: true
type: string
target:
required: true
type: string
extension:
default: ""
type: string

jobs:
build:
name: Build static binaries
runs-on: ${{ inputs.runs_on }}

steps:
- name: Change apt mirror and install dependencies
if: ${{ inputs.runs_on == 'ubuntu-latest' }}
run: |
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install musl-tools libudev-dev
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ inputs.target }}

- uses: Swatinem/rust-cache@v1

- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all --target ${{ inputs.target }}

- uses: papeloto/action-zip@v1
with:
files: target/${{ inputs.target }}/release/web-flash${{ inputs.extension }}
recursive: true
dest: web-flash-${{ inputs.target }}.zip

- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: web-flash-${{ inputs.target }}.zip
tag: ${{ github.ref }}
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
release:
types: [created]

jobs:
# Linux

x86_64-unknown-linux-gnu:
uses: ./.github/workflows/package.yml
with:
runs_on: ubuntu-latest
target: x86_64-unknown-linux-gnu

x86_64-unknown-linux-musl:
uses: ./.github/workflows/package.yml
with:
runs_on: ubuntu-latest
target: x86_64-unknown-linux-musl

# macOS

aarch64-apple-darwin:
uses: ./.github/workflows/package.yml
with:
runs_on: macos-latest
target: aarch64-apple-darwin

x86_64-apple-darwin:
uses: ./.github/workflows/package.yml
with:
runs_on: macos-latest
target: x86_64-apple-darwin

# Windows

x86_64-pc-windows-gnu:
uses: ./.github/workflows/package.yml
with:
runs_on: windows-latest
target: x86_64-pc-windows-gnu
extension: .exe

x86_64-pc-windows-msvc:
uses: ./.github/workflows/package.yml
with:
runs_on: windows-latest
target: x86_64-pc-windows-msvc
extension: .exe

0 comments on commit 946047a

Please sign in to comment.