Skip to content

Release also list.json.xz #27

Release also list.json.xz

Release also list.json.xz #27

name: CI
on:
push:
branches: [ "index-on-ci" ] # FIXME
env:
PROJECT_NAME: "full-project"
ARTIFACT_NAME: "index-assets"
DOWNLOADED_ARTIFACTS: "indexing-results"
jobs:
indexing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: 'sbt'
- name: Generate full-project if requested
if: ${{ env.PROJECT_NAME == 'full-project' }}
run: sbt 'runMain com.virtuslab.example.generator.FullProjectGenerator'
- name: Install IJ
run: sudo snap install intellij-idea-community --channel=2023.3/stable --classic
- name: IJ install Shared Indexes plugin
run: intellij-idea-community installPlugins intellij.indexing.shared
- name: Build shared indexes
run: |
mkdir -p workspace/project-indexes
intellij-idea-community dump-shared-index project --project-id=${{ env.PROJECT_NAME }} --project-dir=examples/${{ env.PROJECT_NAME }} --output=workspace/project-indexes
- name: Build cdn structure
run: sbt 'runMain com.virtuslab.shared_indexes.Main project'
- name: Check indexes
run: ls -lh workspace/cdn
- name: Archive index artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: workspace/cdn
if-no-files-found: error
release:
needs: indexing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set RELEASE_URL
run: echo "RELEASE_URL=https://github.com/${GITHUB_REPOSITORY}/releases/download/${{ env.PROJECT_NAME }}" >> $GITHUB_ENV
- uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.DOWNLOADED_ARTIFACTS }}
- name: Swap data url in index.json.xz
run: |
PATH_TO_INDEX_FILE=(${{ env.DOWNLOADED_ARTIFACTS }}/data/project/${{ env.PROJECT_NAME }}/*.ijx.xz)
.github/scripts/swap-index-url.sh "${{ env.DOWNLOADED_ARTIFACTS }}/project/${{ env.PROJECT_NAME }}/index.json.xz" "${{ env.RELEASE_URL }}/$(basename "$PATH_TO_INDEX_FILE")"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.PROJECT_NAME }}
draft: true
prerelease: false
files: |
${{ env.DOWNLOADED_ARTIFACTS }}/project/list.json.xz
${{ env.DOWNLOADED_ARTIFACTS }}/project/${{ env.PROJECT_NAME }}/index.json.xz
${{ env.DOWNLOADED_ARTIFACTS }}/data/project/${{ env.PROJECT_NAME }}/*.ijx.xz
${{ env.DOWNLOADED_ARTIFACTS }}/data/project/${{ env.PROJECT_NAME }}/*.metadata.json
${{ env.DOWNLOADED_ARTIFACTS }}/data/project/${{ env.PROJECT_NAME }}/*.sha256