Update release.yml #49
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: | |
- '*' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
arch: x86_64-linux | |
- os: macos-latest | |
arch: x86_64-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 | |
# Install dependencies and build for x86_64 and MacOS | |
- name: Build for x86_64 and MacOS | |
run: | | |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then | |
sudo apt-get update | |
sudo apt-get install -y libarchive-dev | |
elif [ "${{ matrix.os }}" = "macos-latest" ]; then | |
brew install automake autoconf | |
make libarchive | |
fi | |
zig build -Dtarget=${{ matrix.arch }} -p "zig-out/${{ matrix.arch }}" | |
# Create a tarball of the artifacts | |
- name: Tarball artifact | |
run: tar -czvf "zvm-${{ matrix.arch }}.tar.gz" -C "zig-out/${{ matrix.arch }}/bin" zvm | |
# Archive production artifacts | |
- 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: "zvm-x86_64-macos-tar/zvm-x86_64-macos.tar.gz,zvm-x86_64-linux-tar/zvm-x86_64-linux.tar.gz" | |
artifactErrorsFailBuild: true | |
generateReleaseNotes: true | |
tag: ${{ github.ref }} | |
name: ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
allowUpdates: true | |
token: ${{ secrets.GITHUB_TOKEN }} |