he #85
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: CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
outputs: | |
envx_version: ${{ env.ENVX_VERSION }} | |
build: ${{ env.BUILD }} | |
steps: | |
- name: Release Please | |
uses: GoogleCloudPlatform/release-please-action@v3 | |
id: release | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: rust | |
- name: Set SemVer String | |
id: set-semver | |
if: steps.release.outputs.release_created == 'true' | |
run: | | |
echo "ENVX_VERSION=${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}" >> $GITHUB_ENV | |
echo "BUILD=true" >> $GITHUB_ENV | |
build-release: | |
name: Build Release | |
needs: [release-please] | |
if: needs.release-please.outputs.build == 'true' | |
permissions: | |
contents: write | |
runs-on: ${{ matrix.os }} | |
continue-on-error: true | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
use-cross: true | |
install-musl: true | |
# - target: i686-unknown-linux-musl | |
# os: ubuntu-latest | |
# - target: aarch64-unknown-linux-musl | |
# os: ubuntu-latest | |
# use-cross: true | |
# - target: arm-unknown-linux-musleabihf | |
# os: ubuntu-latest | |
# use-cross: true | |
- target: x86_64-apple-darwin | |
os: macOS-latest | |
- target: aarch64-apple-darwin | |
os: macOS-latest | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
# - target: i686-pc-windows-msvc | |
# os: windows-latest | |
- target: x86_64-pc-windows-gnu | |
os: windows-latest | |
# - target: i686-pc-windows-gnu | |
# os: windows-latest | |
# use-cross: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Install OPENSSL | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install libssl-dev pkg-config | |
- name: Build release binary | |
run: cargo build --release --locked --target ${{ matrix.target }} | |
- name: Prepare binaries (zip) [Windows] | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release | |
strip envx.exe | |
7z a ../../../envx-${{ needs.release-please.outputs.envx_version }}-${{ matrix.target }}.zip envx.exe | |
cd - | |
- name: Prepare binaries (tar) [Windows] | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release | |
strip envx.exe | |
7z a -ttar archive.tar envx.exe | |
7z a -tgzip ../../../envx-${{ needs.release-please.outputs.envx_version }}-${{ matrix.target }}.tar.gz archive.tar | |
cd - | |
- name: Prepare binaries [-linux] | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release | |
strip envx || true | |
tar czvf ../../../envx-${{ needs.release-please.outputs.envx_version }}-${{ matrix.target }}.tar.gz envx | |
cd - | |
- name: Upload release archive | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ needs.release-please.outputs.envx_version }} | |
files: envx-${{ needs.release-please.outputs.envx_version }}-${{ matrix.target }}* | |
# - name: Install cargo-deb | |
# if: matrix.target == 'x86_64-unknown-linux-musl' | |
# run: cargo install cargo-deb | |
# | |
# - name: Generate .deb package file | |
# if: matrix.target == 'x86_64-unknown-linux-musl' | |
# run: cargo deb --target x86_64-unknown-linux-musl --output envx-${{ needs.release-please.outputs.envx_version }}-amd64.deb | |
# | |
# - name: Upload .deb package file | |
# if: matrix.target == 'x86_64-unknown-linux-musl' | |
# uses: svenstaro/upload-release-action@v2 | |
# with: | |
# tag: ${{ needs.release-please.outputs.envx_version }} | |
# file: envx-${{ needs.release-please.outputs.envx_version }}-amd64.deb |