Skip to content

Commit

Permalink
chore(actions): Impled actions to create release
Browse files Browse the repository at this point in the history
  • Loading branch information
breadrock1 committed Oct 27, 2024
1 parent c383942 commit e069df2
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: "Create release"
on:
push:
branches:
- master
- release/**

jobs:
create-release:
name: create release
runs-on: ubuntu-latest
permissions:
contents: write

outputs:
version_output: ${{ steps.version.outputs.project_version }}
upload_url_output: ${{ steps.release.outputs.upload_url }}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
architecture: x64

- name: Get project version
id: version
run: |
apt update && apt install jq
VERSION=$(cargo metadata --format-version=1 | jq '.packages[] | select(.name=="doc-search").version')
echo "project_version=$VERSION" >> $GITHUB_OUTPUT
- name: Create github release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
body_path: CHANGELOG.md
tag_name: doc-searcher-${{ steps.version.outputs.project_version }}
release_name: doc-searcher-${{ steps.version.outputs.project_version }}

build:
name: build project
strategy:
matrix:
features:
- name: all
options: '--all-features'
- name: with cache
options: '--features enable-cacher'
- name: with semantic
options: '--features enable-semantic'
- name: with prometheus
options: '--features enable-prometheus'

runs-on: ubuntu-latest
needs: create-release
permissions: write-all

steps:
- uses: actions/checkout@v4

- name: Build with feature ${{ matrix.features.name }}
run: cargo build --release --bins ${{ matrix.features.options }}

- name: Create archive
uses: vimtor/action-zip@5f1c4aa587ea41db1110df6a99981dbe19cee310
with:
files: ./target
dest: doc-searcher-${{ matrix.features.name }}-${{ needs.create-release.outputs.version_output }}.zip
recursive: true

- name: Upload linux artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url_output }}
asset_name: doc-searcher-${{ matrix.features.name }}-${{ needs.create-release.outputs.version_output }}.zip
asset_path: ./doc-searcher-${{ matrix.features.name }}-${{ needs.create-release.outputs.version_output }}.zip
asset_content_type: application/zip

0 comments on commit e069df2

Please sign in to comment.