Skip to content

set version to 0.0.1 (test) #3

set version to 0.0.1 (test)

set version to 0.0.1 (test) #3

Workflow file for this run

name: Release
on:
push:
tags:
- v*.*.*
workflow_dispatch:
jobs:
upload-binaries:
name: Upload Binaries
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set release version
run: echo "RELEASE_VERSION=$GITHUB_REF_NAME" >> $GITHUB_ENV
- name: Install Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.12.0
- name: Print meta
run: |
echo $GITHUB_REF_NAME
zig version
zig env
# Build binaries for target queries in `build.zig`, contents
# will be saved in `zig-out`
- name: Build release binaries
run: |
rm -rf zig-out # sanity
zig build release --summary all
# Rename binary folders with name-version prefix, and copy
# other assets into individual release folders.
- name: Collect assets
shell: bash
run: |
version_prefix="fex-${{ env.RELEASE_VERSION }}-"
for build_path in "zig-out"/*; do
echo "Collecting $build_path"
# Rename folder
new_folder_name=$version_prefix$(basename $build_path)
new_build_path="zig-out/$new_folder_name"
mv "$build_path" "$new_build_path"
# Copy assets into release folders
cp {LICENSE,README.md} "$new_build_path"
cp -r shell/. "$new_build_path"
done
# Create tar.gz of release folders, and calculate their
# checksums. Output is stored in `release`.
- name: Prepare artifacts
shell: bash
run: |
mkdir -p release && cd release
for asset in "../zig-out"/*; do
echo "Preparing $asset"
asset_name=$(basename $asset)
tar_name=${asset_name}.tar.gz
tar -C ../zig-out -czvf $tar_name $asset_name
shasum -a 512 $tar_name > ${tar_name}.sha512
done
# Creates a new release and uploads artifacts to it.
- name: Upload for release
uses: svenstaro/upload-release-action@v2
with:
file: release/*
file_glob: true
overwrite: true
tag: ${{ github.ref }}
release_name: 'Release v${{ env.RELEASE_VERSION }}'
repo_token: ${{ secrets.RELEASE_TOKEN }}
draft: true
# Upload artifacts to GHA for inspection incase something
# goes wrong.
- name: Upload for inspection
uses: actions/upload-artifact@v4
with:
name: release-artifact
path: release/
retention-days: 3
overwrite: true
if-no-files-found: error
upload-source:
name: Upload Source
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set release version
run: echo "RELEASE_VERSION=$GITHUB_REF_NAME" >> $GITHUB_ENV
- name: Prepare source code
run: |
cd ..
tar -czvf v${{ env.RELEASE_VERSION }}.tar.gz ${{ github.event.repository.name }}
mv v${{ env.RELEASE_VERSION }}.tar.gz ${{ github.event.repository.name }}
- name: Upload for release
uses: svenstaro/upload-release-action@v2
with:
file: v${{ env.RELEASE_VERSION }}.tar.gz
file_glob: true
overwrite: true
tag: ${{ github.ref }}
release_name: 'Release v${{ env.RELEASE_VERSION }}'
repo_token: ${{ secrets.RELEASE_TOKEN }}
draft: true