Create info and edit sub commands for config #50
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: | |
CARGO_TERM_COLOR: always | |
permissions: | |
contents: write | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-and-release: | |
needs: create-release | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
asset_name: lazydraft-linux-amd64 | |
executable_name: lazydraft | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
asset_name: lazydraft-macos-amd64 | |
executable_name: lazydraft | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
asset_name: lazydraft-windows-amd64.exe | |
executable_name: lazydraft.exe | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Tag Name | |
id: extract_tag | |
run: echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
override: true | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target ${{ matrix.target }} | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --target ${{ matrix.target }} | |
- name: Package Binary (Unix) | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release | |
tar czf ../../../${{ matrix.asset_name }}.tar.gz ${{ matrix.executable_name }} | |
cd ../../.. | |
- name: Package Binary (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release | |
7z a ../../../${{ matrix.asset_name }}.zip ${{ matrix.executable_name }} | |
cd ../../.. | |
- name: Upload Release Asset (Unix) | |
if: matrix.os != 'windows-latest' | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ matrix.asset_name }}.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Release Asset (Windows) | |
if: matrix.os == 'windows-latest' | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ matrix.asset_name }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Compute SHA256 | |
if: matrix.os == 'macos-latest' | |
id: sha256 | |
run: | | |
curl -L -o lazydraft.tar.gz https://github.com/yigitozgumus/lazydraft/releases/download/${{ env.tag_name }}/lazydraft-macos-amd64.tar.gz | |
shasum -a 256 lazydraft.tar.gz | awk '{ print $1 }' > sha256.txt | |
echo "::set-output name=sha256::$(cat sha256.txt)" | |
- name: Clone Homebrew Tap | |
if: matrix.os == 'macos-latest' | |
run: | | |
git clone https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/yigitozgumus/homebrew-formulae.git | |
cd homebrew-formulae | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
- name: Update Formula | |
if: matrix.os == 'macos-latest' | |
run: | | |
cd homebrew-formulae | |
cd Formula | |
# Update the version lines | |
sed -i '' "s|version \".*\"|version \"${{ env.tag_name }}\"|g" lazydraft.rb | |
# Update the URL | |
sed -i '' "s|url \".*\"|url \"https://github.com/yigitozgumus/lazydraft/releases/download/${{ env.tag_name }}/lazydraft-macos-amd64.tar.gz\"|" lazydraft.rb | |
# Update the sha256 | |
sed -i '' "s|sha256 \".*\"|sha256 \"${{ steps.sha256.outputs.sha256 }}\"|" lazydraft.rb | |
git add lazydraft.rb | |
git commit -m "Update lazydraft formula for version ${{ env.tag_name }}" | |
git push https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/yigitozgumus/homebrew-formulae.git main |