Skip to content

Add CI for building and releasing index files #19

Add CI for building and releasing index files

Add CI for building and releasing index files #19

name: CI
on:
push:
branches: [ "index-on-ci" ] # FIXME
jobs:
# indexing:
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v4
#
# - 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: IJ build shared indexes
# run: |
# mkdir -p workspace/project-indexes
# intellij-idea-community dump-shared-index project --project-id=multi-jar --project-dir=examples/multi-jar --output=workspace/project-indexes
#
# - name: Set up JDK 11
# uses: actions/setup-java@v4
# with:
# java-version: '11'
# distribution: 'temurin'
# cache: 'sbt'
# - name: IJ build cdn structure
# run: sbt 'runMain com.virtuslab.shared_indexes.Main project'
#
# - name: IJ check indexes
# run: ls -lh workspace/cdn
#
# - name: Archive index artifacts
# uses: actions/upload-artifact@v3
# with:
# name: index-assets
# path: workspace/cdn
# if-no-files-found: error
release:
# needs: indexing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set TAG and RELEASE_URL
run: |
echo "TAG=$(cat .github/release-tag.txt)" >> $GITHUB_ENV
echo "RELEASE_URL=https://github.com/${GITHUB_REPOSITORY}/releases/${TAG}" >> $GITHUB_ENV
- name: Set TAG and RELEASE_URL
run: |
echo $TAG
echo $(cat .github/release-tag.txt)
- name: Download Artifacts
run: |
mkdir -p indexing-results/data/project/multi-jar
mkdir -p indexing-results/project/multi-jar
echo "list.json" > indexing-results/project/list.json.xz
echo "index.json" > indexing-results/project/multi-jar/index.json.xz
echo "index.ijx" > indexing-results/data/project/multi-jar/1234567.ijx.xz
echo "metadata.json" > indexing-results/data/project/multi-jar/1234567.metadata.json
echo "sha.256" > indexing-results/data/project/multi-jar/1234567.sha256
# uses: actions/download-artifact@v3
# with:
# name: index-assets
# path: indexing-results
- name: IJ check indexes
run: ls -lhR indexing-results
- name: IJ check indexes
run: ls -lhR .
- name: Swap data url in index.json.xz
run: |
PATH_TO_INDEX_FILE=(indexing-results/data/project/multi-jar/*.ijx.xz)
.github/scripts/swap-index-url.sh $PATH_TO_INDEX_FILE "$RELEASE_URL/$(basename "$PATH_TO_INDEX_FILE")"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${TAG}
draft: true
prerelease: false
files: |
indexing-results/project/list.json.xz
indexing-results/project/multi-jar/index.json.xz
indexing-results/data/project/multi-jar/*.ijx.xz
indexing-results/data/project/multi-jar/*.metadata.json
indexing-results/data/project/multi-jar/*.sha256