Skip to content

fix: release ci

fix: release ci #13

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
build-ubuntu:
runs-on: ubuntu-latest
outputs:
asset_path: ${{ steps.upload.outputs.asset_path }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Build
run: cargo build --release
- name: Upload Artifact
id: upload
uses: actions/upload-artifact@v2
with:
name: screenpipe-ubuntu
path: target/release/screenpipe
build-macos:
runs-on: macos-latest
outputs:
asset_path: ${{ steps.upload.outputs.asset_path }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Build
run: cargo build --release
- name: Upload Artifact
id: upload
uses: actions/upload-artifact@v2
with:
name: screenpipe-macos
path: target/release/screenpipe
release:
runs-on: ubuntu-latest
needs: [build-ubuntu, build-macos] # todo windows
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: screenpipe-ubuntu
path: ./artifacts/ubuntu
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: screenpipe-macos
path: ./artifacts/macos
- name: Set Version
shell: bash
run: |
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
echo "RELEASE_VERSION=$(echo ${GITHUB_REF_NAME} | cut -f1 -d-)" >> $GITHUB_ENV
- name: Create or update Release
run: |
echo "Looking for existing release for ${{ env.RELEASE_VERSION }}"
OLD_TAG=$(gh release ls --json name,tagName | jq -r ".[] | select(.name == \"${{ env.RELEASE_VERSION }}\") | .tagName")
if [ -n "$OLD_TAG" ]; then
echo "Updating release ${{ env.RELEASE_VERSION }} to point to new tag ${GITHUB_REF_NAME}"
gh release edit ${OLD_TAG} --tag ${GITHUB_REF_NAME}
else
echo "Creating new release ${{ env.RELEASE_VERSION }} pointing to tag ${GITHUB_REF_NAME}"
gh release create ${GITHUB_REF_NAME} \
--title ${{ env.RELEASE_VERSION }} \
--draft \
--generate-notes \
--prerelease
fi
echo "Uploading artifacts for tag ${GITHUB_REF_NAME}"
gh release upload ${GITHUB_REF_NAME} dist/* --clobber