refactor(zigcli): upgrade dependencies to Zig 0.16 #245
Workflow file for this run
This file contains hidden or 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: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - "**.zig" | |
| - ".github/build-release.sh" | |
| - ".github/workflows/CI.yml" | |
| - ".github/workflows/release.yml" | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "**.zig" | |
| - ".github/workflows/release.yml" | |
| tags: | |
| - "v*" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| upload-assets: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| targets: | |
| - "aarch64-linux" | |
| - "x86_64-linux" | |
| - "x86_64-macos" | |
| - "x86_64-windows" | |
| - "aarch64-windows" | |
| - "x86_64-freebsd" | |
| - "aarch64-freebsd" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: mlugg/setup-zig@v2 | |
| - name: Set env(release) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV | |
| echo "OUT_DIR=/tmp/zigcli" >> $GITHUB_ENV | |
| - name: Set env(dev) | |
| if: "!startsWith(github.ref, 'refs/tags/')" | |
| run: | | |
| echo "RELEASE_VERSION=nightly" >> $GITHUB_ENV | |
| echo "OUT_DIR=/tmp/zigcli" >> $GITHUB_ENV | |
| - name: Build(Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| export TARGET="${{ matrix.targets }}" | |
| bash .github/release-single.sh | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: ${{ env.OUT_DIR }}/* | |
| - name: Upload | |
| if: "!startsWith(github.ref, 'refs/tags/')" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zigcli-${{ matrix.os }}-${{ matrix.targets }} | |
| path: ${{ env.OUT_DIR }} | |
| upload-assets-mac: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: mlugg/setup-zig@v2 | |
| - name: Set env(release) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV | |
| echo "OUT_DIR=/tmp/zigcli" >> $GITHUB_ENV | |
| - name: Set env(dev) | |
| if: "!startsWith(github.ref, 'refs/tags/')" | |
| run: | | |
| echo "RELEASE_VERSION=nightly" >> $GITHUB_ENV | |
| echo "OUT_DIR=/tmp/zigcli" >> $GITHUB_ENV | |
| - name: Build(MacOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| export GIT_COMMIT=$(git rev-parse --short HEAD) | |
| export BUILD_DATE=$(date +'%Y-%m-%dT%H:%M:%S%z') | |
| mkdir -p "${OUT_DIR}" | |
| zig build -Doptimize=ReleaseSafe -Dcpu=apple_m1 \ | |
| -Dgit_commit=${GIT_COMMIT} -Dbuild_date=${BUILD_DATE} -Dversion=${RELEASE_VERSION} | |
| rm -f zig-out/bin/*demo | |
| cp LICENSE README.org zig-out | |
| find zig-out | |
| pushd zig-out | |
| zip -r ${OUT_DIR}/zigcli-${RELEASE_VERSION}-aarch64-macos.zip . | |
| popd | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: ${{ env.OUT_DIR }}/* | |
| - name: Upload | |
| if: "!startsWith(github.ref, 'refs/tags/')" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zigcli-${{ matrix.os }} | |
| path: ${{ env.OUT_DIR }} |