Continuous Deployment #3
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: Continuous Deployment | |
on: | |
push: | |
tags: | |
- '[v]?[0-9]+.[0-9]+.[0-9]+' | |
workflow_dispatch: | |
jobs: | |
build-binaries: | |
name: Publishing for ${{ matrix.job.name }} | |
runs-on: ${{ matrix.job.os }} | |
strategy: | |
matrix: | |
rust: [stable] | |
job: | |
- os: macos-latest | |
name: MacOS x86_64-apple-darwin | |
os-name: macos | |
target: x86_64-apple-darwin | |
architecture: x86_64 | |
binary-postfix: "" | |
use-cross: false | |
- os: macos-latest | |
name: MacOS aarch64-apple-darwin | |
os-name: macos | |
target: aarch64-apple-darwin | |
architecture: arm64 | |
binary-postfix: "" | |
use-cross: false | |
- os: ubuntu-latest | |
name: Ubuntu x86_64-unknown-linux-gnu | |
os-name: linux | |
target: x86_64-unknown-linux-gnu | |
architecture: x86_64 | |
binary-postfix: "" | |
use-cross: false | |
- os: windows-latest | |
name: Windows | |
os-name: windows | |
target: x86_64-pc-windows-msvc | |
architecture: x86_64 | |
binary-postfix: ".exe" | |
use-cross: false | |
- os: ubuntu-latest | |
name: Ubuntu aarch64-unknown-linux-gnu | |
os-name: linux | |
target: aarch64-unknown-linux-gnu | |
architecture: arm64 | |
binary-postfix: "" | |
use-cross: true | |
- os: ubuntu-latest | |
name: Ubuntu | |
os-name: linux i686-unknown-linux-gnu | |
target: i686-unknown-linux-gnu | |
architecture: i686 | |
binary-postfix: "" | |
use-cross: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
target: ${{ matrix.job.target }} | |
profile: minimal | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- name: Cargo build ${{ matrix.job.target }} | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
use-cross: ${{ matrix.job.use-cross }} | |
toolchain: ${{ matrix.rust }} | |
args: --release --target ${{ matrix.job.target }} | |
- name: Packaging final binary ${{ matrix.job.target }} | |
shell: bash | |
run: | | |
cd target/${{ matrix.job.target }}/release | |
########## create tar.gz ########## | |
BINARY_NAME=places${{ matrix.job.binary-postfix }} | |
RELEASE_NAME=places-${GITHUB_REF/refs\/tags\//}-${{ matrix.job.os-name }}-${{ matrix.job.architecture }} | |
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME | |
- name: Releasing assets | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
target/${{ matrix.job.target }}/release/places-*.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-msi: | |
name: "Build MSI installer" | |
runs-on: "windows-2019" | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 # v4.1.1 | |
with: | |
fetch-depth: 1 | |
- name: Install Net-Framework-Core | |
shell: powershell | |
run: Install-WindowsFeature Net-Framework-Core | |
- name: Install wixtoolset | |
uses: crazy-max/ghaction-chocolatey@0e015857dd851f84fcb7fb53380eb5c4c8202333 # v3.0.0 | |
with: | |
args: install -y wixtoolset | |
- name: Set up Rust toolchain | |
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a | |
with: | |
toolchain: stable | |
target: x86_64-pc-windows-msvc | |
- name: Build MSI file | |
shell: powershell | |
env: | |
BTM_GENERATE: "" | |
run: | | |
cargo install cargo-wix --version 0.3.8 --locked | |
cargo wix | |
- name: Generate artifact attestation for file | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: "places-cli_x86_64_installer.msi" | |
- name: Create release directory for artifact, move files | |
shell: bash | |
run: | | |
mkdir release | |
mv places-cli_x86_64_installer.msi release/ | |
- name: Releasing assets | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
target/${{ matrix.job.target }}/release/places-cli_x86_64_installer.msi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |