Skip to content

feat: v0.2.60

feat: v0.2.60 #153

Workflow file for this run

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@v4
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 }}
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@v4
with:
fetch-depth: 1
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
components: rustfmt, clippy
- name: Install Wix [Windows]
if: matrix.os == 'windows-latest'
run: cargo install cargo-wix
- name: Install Cross [Linux]
if: matrix.os == 'ubuntu-latest'
run: cargo install cross
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Build release binary
run: ${{ matrix.os == 'ubuntu-latest' && 'cross' || 'cargo' }} build --release --locked ${{ matrix.flags }} --target ${{ matrix.target }} --package hop-cli
- 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'
run: cargo wix -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@v4
with:
fetch-depth: 1
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- name: Login to Crates
run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish Crates
run: cargo publish --locked --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