ver: 0.2.7 #10
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
name: release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
RUSTUP_MAX_RETRIES: 10 | |
MACOSX_DEPLOYMENT_TARGET: 10.15 | |
concurrency: | |
group: release | |
cancel-in-progress: true | |
jobs: | |
dist: | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
code-target: win32-x64 | |
extension: .exe | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
code-target: linux-x64 | |
- os: macos-11 | |
target: x86_64-apple-darwin | |
code-target: darwin-x64 | |
- os: macos-11 | |
target: aarch64-apple-darwin | |
code-target: darwin-arm64 | |
name: dist (${{ matrix.target }}) | |
runs-on: ${{ matrix.os }} | |
env: | |
RA_TARGET: ${{ matrix.target }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Cargo Cache | |
uses: actions/cache@v3 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ matrix.target }}-cargo- | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
override: true | |
- name: Update apt repositories | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libasound2-dev | |
- name: Dist | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --all-features --target ${{ matrix.target }} | |
- name: Rename | |
shell: bash | |
run: | | |
rm -f "target/${{ matrix.target }}/release/charcoal-${{ matrix.target }}${{ matrix.extension }}" | |
mv "target/${{ matrix.target }}/release/charcoal${{ matrix.extension }}" "target/${{ matrix.target }}/release/charcoal-${{ matrix.target }}${{ matrix.extension }}" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: Charcoal-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/charcoal-${{ matrix.target }}${{ matrix.extension }} | |
publish: | |
name: publish | |
runs-on: ubuntu-latest | |
needs: ["dist"] | |
steps: | |
- name: Generate Tag | |
run: | | |
# Strip git ref prefix from version | |
TAG=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
[ "$TAG" == "main" ] && TAG=nightly | |
echo "TAG=$(echo $TAG)" >> $GITHUB_ENV | |
echo "TAG: $TAG" | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v1 | |
with: | |
name: Charcoal-aarch64-apple-darwin | |
path: dist | |
- uses: actions/download-artifact@v1 | |
with: | |
name: Charcoal-x86_64-apple-darwin | |
path: dist | |
- uses: actions/download-artifact@v1 | |
with: | |
name: Charcoal-x86_64-unknown-linux-gnu | |
path: dist | |
- uses: actions/download-artifact@v1 | |
with: | |
name: Charcoal-x86_64-pc-windows-msvc | |
path: dist | |
- run: ls -al ./dist | |
- uses: "marvinpinto/action-automatic-releases@d68defdd11f9dcc7f52f35c1b7c236ee7513bcc1" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: ${{ env.TAG }} | |
prerelease: false | |
title: Charcoal | |
files: "dist/*" |