Skip to content

Update release.yml

Update release.yml #43

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
arch: x86_64-linux
- os: ubuntu-latest
arch: aarch64-linux
- os: macos-latest
arch: x86_64-macos
- os: macos-latest
arch: aarch64-macos
# ...and so on for each supported architecture
steps:
- uses: actions/checkout@v2
- name: Update submodules
run: git submodule update --init --recursive
# Conditional step for installing dependencies on Linux
- name: Install dependencies on Linux
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install libarchive-dev
# Conditional step for installing dependencies on MacOS
- name: Install dependencies on MacOS
if: startsWith(matrix.os, 'macos')
run: |
brew install automake autoconf libarchive
# Setup Zig step remains the same
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.11.0
# Dynamic build command using matrix variables
- name: Build
run: zig build -Dtarget=${{ matrix.arch }} -p "zig-out/${{ matrix.arch }}"
- name: Tarball artifact
run: tar -czvf "zvm-${{ matrix.arch }}.tar.gz" -C "zig-out/${{ matrix.arch }}/bin" zvm
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: "zvm-${{ matrix.arch }}-tar"
path: "zvm-${{ matrix.arch }}.tar.gz"
# This job will need to be modified to handle multiple artifacts
create-release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v3
# Download all artifacts dynamically
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: artifacts/
- name: List artifacts
run: ls -la artifacts/
- name: Create and Upload Release
uses: ncipollo/release-action@v1
with:
# You will need to dynamically construct the artifacts string based on the outputs of the build job
artifacts: ${{ steps.artifacts.outputs.artifacts }}
tag: ${{ github.ref }}
name: ${{ github.ref_name }}
draft: false
prerelease: false
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}