Skip to content

v1.0.0

v1.0.0 #32

Workflow file for this run

name: Build and Release pyinit CLI
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
file_extension: ""
- os: macos-latest
target: x86_64-apple-darwin
file_extension: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
file_extension: ".exe"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build the CLI
run: cargo build --release --target ${{ matrix.target }}
- name: Set executable permissions (Linux/macOS)
if: ${{ matrix.os != 'windows-latest' }}
run: chmod +x target/${{ matrix.target }}/release/pyinit
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-${{ matrix.os }}
path: target/${{ matrix.target }}/release/pyinit${{ matrix.file_extension }}
archive:
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
file_extension: ""
- os: macos-latest
file_extension: ""
- os: windows-latest
file_extension: ".exe"
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-${{ matrix.os }}
- name: Archive the build output (Linux/macOS)
if: ${{ matrix.os != 'windows-latest' }}
run: |
mkdir -p dist
zip -j dist/pyinit-${{ matrix.os }}-${{ github.ref_name }}.zip pyinit
- name: Archive the build output (Windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist
Compress-Archive -Path "pyinit${{ matrix.file_extension }}" -DestinationPath "dist/pyinit-${{ matrix.os }}-${{ github.ref_name }}.zip"
- name: Upload archive artifacts
uses: actions/upload-artifact@v3
with:
name: archive-${{ matrix.os }}
path: dist/*.zip
release:
needs: archive
runs-on: ubuntu-latest
steps:
- name: Download archive artifacts (Linux)
uses: actions/download-artifact@v3
with:
name: archive-ubuntu-latest
- name: Download archive artifacts (macOS)
uses: actions/download-artifact@v3
with:
name: archive-macos-latest
- name: Download archive artifacts (Windows)
uses: actions/download-artifact@v3
with:
name: archive-windows-latest
- name: Move artifacts to dist folder
run: |
mkdir -p dist
mv pyinit*.zip dist/
- name: Upload build artifacts as release assets
uses: softprops/action-gh-release@v2
with:
files: dist/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}