fix: release ci #14
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
# to test: | |
# act --env ACTIONS_RUNTIME_URL=http://host.docker.internal:8080/ --env ACTIONS_RUNTIME_TOKEN=foo --env ACTIONS_CACHE_URL=http://host.docker.internal:8080/ --artifact-server-path out | |
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: Sign Binary | |
run: | | |
codesign --sign "{{ secrets.MACOS_SIGNING_IDENTITY }}" --timestamp --options runtime target/release/screenpipe | |
- 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 |