Build and Release #49
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: Cross Build and Release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "v[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}" | |
permissions: | |
contents: write | |
jobs: | |
# build-linux: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v3 | |
# | |
# - name: Install Rust | |
# uses: actions-rs/toolchain@v1 | |
# with: | |
# profile: minimal | |
# override: true | |
# toolchain: stable | |
# | |
# - name: Create artificats directory | |
# run: mkdir artifacts | |
# - name: Install system dependencies | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get install -y \ | |
# libxcb1-dev \ | |
# libxcb-render0-dev \ | |
# libxcb-shape0-dev \ | |
# libxcb-xfixes0-dev | |
# | |
# - name: Build for Linux | |
# run: cargo build --release | |
# | |
# - name: Copy binary to artifacts | |
# run: cp target/release/jobshell artifacts/ | |
# | |
# - name: Upload Linux binary | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: linux-artifacts | |
# path: artifacts/ | |
# | |
# build-windows: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v3 | |
# | |
# - name: Install Rust | |
# uses: actions-rs/toolchain@v1 | |
# with: | |
# profile: minimal | |
# override: true | |
# toolchain: stable | |
# target: x86_64-pc-windows-gnu | |
# | |
# - name: Install cross | |
# run: cargo install cross --git https://github.com/cross-rs/cross | |
# | |
# - name: Build for Windows | |
# run: cross build --release --target x86_64-pc-windows-gnu | |
# | |
# - name: Create artifacts directory | |
# run: mkdir artifacts | |
# | |
# - name: Copy binary to artifacts | |
# run: cp target/x86_64-pc-windows-gnu/release/jobshell.exe artifacts/ | |
# | |
# - name: Upload Windows binary | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: windows-artifacts | |
# path: artifacts/ | |
# | |
# build-macos: | |
# runs-on: macos-latest | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v3 | |
# | |
# - name: Install Rust | |
# uses: actions-rs/toolchain@v1 | |
# with: | |
# profile: minimal | |
# override: true | |
# toolchain: stable | |
# | |
# - name: Add macOS targets | |
# run: | | |
# rustup target add x86_64-apple-darwin | |
# rustup target add aarch64-apple-darwin | |
# | |
# - name: Create artifacts directory | |
# run: mkdir artifacts | |
# | |
# - name: Build for macOS (x86_64) | |
# run: cargo build --release --target x86_64-apple-darwin | |
# | |
# - name: Copy x86_64 binary | |
# run: cp target/x86_64-apple-darwin/release/jobshell artifacts/jobshell-x86_64 | |
# | |
# - name: Build for macOS (aarch64) | |
# run: cargo build --release --target aarch64-apple-darwin | |
# | |
# - name: Copy aarch64 binary | |
# run: cp target/aarch64-apple-darwin/release/jobshell artifacts/jobshell-aarch64 | |
# | |
# - name: Upload macOS binaries | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: macos-artifacts | |
# path: artifacts/ | |
# | |
# release: | |
# needs: [build-windows, build-macos, build-linux] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v3 | |
# | |
# - name: Create release directory | |
# run: mkdir release-binaries | |
# | |
# - name: Download all artifacts | |
# uses: actions/download-artifact@v3 | |
# with: | |
# path: release-binaries | |
# | |
# - name: Create Release | |
# id: create_release | |
# uses: actions/create-release@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# tag_name: ${{ github.ref_name }} | |
# release_name: Release ${{ github.ref_name }} | |
# draft: false | |
# prerelease: false | |
# | |
# - name: Upload Windows Binary | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: release-binaries/windows-artifacts/jobshell.exe | |
# asset_name: jobshell-windows-x86_64.exe | |
# asset_content_type: application/octet-stream | |
# | |
# - name: Upload macOS x86_64 Binary | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: release-binaries/macos-artifacts/jobshell-x86_64 | |
# asset_name: jobshell-macos-x86_64 | |
# asset_content_type: application/octet-stream | |
# | |
# - name: Upload macOS aarch64 Binary | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: release-binaries/macos-artifacts/jobshell-aarch64 | |
# asset_name: jobshell-macos-aarch64 | |
# asset_content_type: application/octet-stream | |
# | |
# - name: Upload Linux binary | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: release-binaries/linux-artifacts/jobshell | |
# asset_name: jobshell-linux | |
# asset_content_type: application/octet-stream | |
# | |
publish-to-cargo: | |
# needs: [release] | |
runs-on: macos-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Install Rust | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
# # Step 3: Validate the package | |
# - name: Validate Cargo Package | |
# run: cargo package --allow-dirty | |
# env: | |
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
- name: Verify Secret | |
run: echo ${{ secrets.MY_SECRET }} | |
# Step 4: Publish to Crates.io | |
- name: Publish to crates.io | |
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
# env: | |
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
# update-homebrew-tap: | |
# # needs: [release] | |
# runs-on: macos-latest | |
# permissions: | |
# contents: write # important for pushing changes | |
# steps: | |
# # Step 1: Extract version from the tag | |
# - name: Extract version | |
# id: extract_version | |
# run: | | |
# TAG_NAME=${GITHUB_REF##*/} | |
# VERSION=${TAG_NAME#v} | |
# echo "Extracted version: $VERSION" | |
# echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
# | |
# # Step 2: Check out the homebrew-jobshell repository | |
# # This ensures correct Git credentials are set up automatically | |
# - name: Checkout homebrew-jobshell | |
# uses: actions/checkout@v3 | |
# with: | |
# repository: angelplusultra/homebrew-jobshell | |
# path: homebrew-jobshell | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
# | |
# # Step 3: Configure Git user.name / user.email | |
# - name: Configure Git | |
# run: | | |
# cd homebrew-jobshell | |
# git config user.name "github-actions" | |
# git config user.email "github-actions@github.com" | |
# | |
# # Step 4: Run your script | |
# - name: Run Homebrew update script | |
# working-directory: homebrew-jobshell | |
# run: ./script.sh $VERSION | |
# |