feat: v0.2.56 #148
Workflow file for this run
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: | |
push: | |
tags: | |
- "v*" | |
env: | |
MACOSX_DEPLOYMENT_TARGET: 10.7 | |
jobs: | |
draft-release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
outputs: | |
tag_name: ${{ steps.tag.outputs.tag_name }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Get tag data | |
id: tag | |
run: | | |
# replace the following commands to use the new GITHUB_OUTPUT syntax | |
echo "tag_name=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+-[0-9]+$ ]]; then | |
echo "pre_release=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Create new release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
prerelease: ${{ steps.tag.outputs.pre_release == 'true' }} | |
title: "Version: ${{ steps.tag.outputs.tag_name }}" | |
draft: true | |
build-release: | |
name: Build Release Assets | |
needs: ["draft-release"] | |
runs-on: ${{ matrix.os }} | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
platform: x86_64-Linux | |
flags: --all-features | |
- target: i686-unknown-linux-musl | |
os: ubuntu-latest | |
platform: i686-Linux | |
flags: --all-features | |
- target: aarch64-unknown-linux-musl | |
os: ubuntu-latest | |
platform: aarch64-Linux | |
flags: --all-features | |
- target: arm-unknown-linux-musleabihf | |
os: ubuntu-latest | |
platform: arm-Linux | |
flags: --all-features | |
- target: x86_64-apple-darwin | |
os: macOS-latest | |
platform: x86_64-Darwin | |
flags: --all-features | |
- target: aarch64-apple-darwin | |
os: macOS-latest | |
platform: aarch64-Darwin | |
flags: --all-features | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
platform: x86_64-Windows | |
flags: --all-features | |
- target: i686-pc-windows-msvc | |
os: windows-latest | |
platform: i686-Windows | |
flags: --all-features | |
# these targets currently fail for unknown reasons | |
# - target: aarch64-pc-windows-msvc | |
# os: windows-latest | |
# platform: aarch64-windows | |
# - target: x86_64-unknown-freebsd | |
# os: ubuntu-latest | |
# platform: x86_64-FreeBSD | |
# flags: --all-features | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
profile: minimal | |
override: true | |
- name: Install Wix [Windows] | |
if: matrix.os == 'windows-latest' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: cargo-wix | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build release binary | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --locked ${{ matrix.flags }} --target ${{ matrix.target }} --package hop-cli | |
use-cross: ${{ matrix.os == 'ubuntu-latest' }} | |
- name: Prepare binaries [*nix] | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release | |
strip hop || true | |
tar czvf ../../../hop-${{ matrix.platform }}.tar.gz hop | |
cd - | |
- name: Prepare binaries [Windows] | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release | |
strip hop.exe | |
7z a ../../../hop-${{ matrix.platform }}.zip hop.exe | |
cd - | |
- name: Build installer [Windows] | |
if: matrix.os == 'windows-latest' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: wix | |
args: -I .\build\windows\main.wxs -v --no-build --nocapture --target ${{ matrix.target }} --output target\wix\hop-${{ matrix.platform }}.msi --package hop-cli | |
- name: Upload binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: hop-${{ matrix.platform }}.${{ matrix.os == 'windows-latest' && 'zip' || 'tar.gz' }} | |
path: hop-${{ matrix.platform }}.${{ matrix.os == 'windows-latest' && 'zip' || 'tar.gz' }} | |
- name: Upload installer [Windows] | |
if: matrix.os == 'windows-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: hop-${{ matrix.platform }}.msi | |
path: target/wix/hop-${{ matrix.platform }}.msi | |
publish-release: | |
name: Publish Release | |
needs: ["draft-release", "build-release"] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
environment: prod | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
- name: Create Checksums | |
run: for file in hop-*/hop-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done | |
- name: Update Release | |
run: gh release edit ${{ needs.draft-release.outputs.tag_name }} --draft=false --repo=${{ github.repository }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add Artifacts to Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: hop-*/hop-* | |
tag_name: ${{ needs.draft-release.outputs.tag_name }} | |
publish-crates: | |
name: Publish Crates | |
needs: ["draft-release", "build-release"] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
environment: prod | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
- name: Login to Crates | |
uses: actions-rs/cargo@v1 | |
with: | |
command: login | |
args: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
- name: Publish Crates | |
uses: actions-rs/cargo@v1 | |
with: | |
command: publish | |
args: --no-verify | |
publish-aur: | |
name: Publish to AUR | |
needs: ["draft-release", "build-release"] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
environment: prod | |
steps: | |
- name: Setup SSH | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.AUR_SSH_KEY }}" > ~/.ssh/id_ed25519 | |
chmod 0600 ~/.ssh/id_ed25519 | |
echo "${{ secrets.AUR_SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts | |
chmod 0600 ~/.ssh/known_hosts | |
- name: Clone AUR repo | |
run: | | |
git config --global user.name "${{ secrets.AUR_GIT_USER }}" | |
git config --global user.email "${{ secrets.AUR_GIT_EMAIL }}" | |
git clone ssh://aur@aur.archlinux.org:/hop-cli.git --depth 1 | |
- name: Update PKGBUILD | |
run: | | |
cd hop-cli | |
curl -fsSL https://github.com/${{ github.repository }}/archive/refs/tags/${{ needs.draft-release.outputs.tag_name }}.tar.gz -o hop-cli-archive.tar.gz | |
VERSION=$(echo ${{ needs.draft-release.outputs.tag_name }} | sed 's/v//') | |
OLD_VERSION=$(cat .SRCINFO | awk '/pkgver = (.*)/{ print $3 }') | |
sed -i "s/pkgver=.*/pkgver=$VERSION/" PKGBUILD | |
sed -i "s/pkgrel=.*/pkgrel=1/" PKGBUILD | |
sed -i "s/$OLD_VERSION/$VERSION/g" .SRCINFO | |
sed -i "s/pkgrel = .*/pkgrel = 1/" .SRCINFO | |
CHECKSUM=$(sha256sum hop-cli-archive.tar.gz | awk '{ print $1 }') | |
sed -i "s/sha256sums=.*/sha256sums=(\"$CHECKSUM\")/" PKGBUILD | |
sed -i "s/sha256sums = .*/sha256sums = $CHECKSUM/" .SRCINFO | |
- name: Push to AUR | |
run: | | |
cd hop-cli | |
git add PKGBUILD .SRCINFO | |
git commit -m "Update PKGBUILD for ${{ needs.draft-release.outputs.tag_name }}" | |
git push origin master | |
publish-homebrew: | |
name: Update Homebrew Formula | |
needs: ["draft-release", "build-release"] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
environment: prod | |
steps: | |
- name: Clone Homebrew repo | |
run: | | |
git config --global user.name "hopdeployer" | |
git config --global user.email "phin+hopdeployer@hop.io" | |
git clone https://github.com/hopinc/homebrew-tap.git --depth 1 | |
- name: Update Formula | |
run: | | |
cd homebrew-tap | |
curl -fsSL https://github.com/${{ github.repository }}/archive/${{ needs.draft-release.outputs.tag_name }}.tar.gz -o hop-cli-archive.tar.gz | |
CHECKSUM=$(sha256sum hop-cli-archive.tar.gz | awk '{ print $1 }') | |
sed -i "s/\/v.*.tar.gz/\/${{ needs.draft-release.outputs.tag_name }}.tar.gz/" hop.rb | |
sed -i "s/sha256 .*/sha256 \"$CHECKSUM\"/" hop.rb | |
- name: Push to Homebrew | |
run: | | |
cd homebrew-tap | |
git add hop.rb | |
git commit -m "Update hop.rb for ${{ needs.draft-release.outputs.tag_name }}" | |
git push https://${{ secrets.GHCR_TOKEN }}@github.com/hopinc/homebrew-tap.git main |