Skip to content

Merge pull request #47 from lucidsoftware/dependabot/github_actions/d… #43

Merge pull request #47 from lucidsoftware/dependabot/github_actions/d…

Merge pull request #47 from lucidsoftware/dependabot/github_actions/d… #43

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- master
tags:
- "*.*.*"
defaults:
run:
shell: bash
jobs:
build-and-test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.ivy2/cache
~/.sbt
~/.coursier
target/
*/target/
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/*.scala') }}
restore-keys: |
${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-
${{ runner.os }}-sbt-
- name: Set SBT_OPTS
run: bash gen_sbt_opts.sh
- name: Build
run: sbt compile packageBin packageDoc packageSrc
- name: Test
run: sbt test
- uses: actions/upload-artifact@v3
with:
name: jars
path: '*/target/*/*.jar'
retention-days: 1
publish:
if: github.event_name != 'pull_request'
needs: build-and-test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.ivy2/cache
~/.sbt
~/.coursier
target/
*/target/
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/*.scala') }}
- name: Set SBT_OPTS
run: bash gen_sbt_opts.sh
- name: Publish to Sonatype
run: bash publish.sh
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
release:
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: build-and-test
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/[email protected]
with:
name: jars
- name: Upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
tag="${GITHUB_REF#refs/tags/}"
args=$(printf -- "-a %q " {xtract-core,testing,macros}/target/*/*.jar)
hub release create $args -m "Release $tag" $tag
publish-docs:
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: code
- name: Checkout pages
uses: actions/checkout@v3
with:
ref: refs/heads/gh-pages
path: pages
- uses: actions/cache@v3
with:
path: |
~/.ivy2/cache
~/.sbt
~/.coursier
target/
*/target/
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/*.scala') }}
- name: Build docs
run: sbt "xtract / doc" "xtractMacros / doc" "xtractTesting / doc"
working-directory: ./code
- name: Copy docs
run: |
version="${GITHUB_REF#refs/*/}"
mkdir -p pages/{core,macros,testing}/api/$version
cp -rf xtract-core/target/jvm-$SCALA_VERS/api/* pages/core/api/$version/
cp -rf macros/target/jvm-$SCALA_VERS/api/* pages/macros/api/$version/
cp -rf testing/target/jvm-$SCALA_VERS/api/* pages/testing/api/$version/
env:
SCALA_VERS: 2.13
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "github-actions [bot]"
git add .
git commit -m "Add documentation for ${{ github.ref }}"
working-directory: ./pages
- name: Push changes
run: git push origin HEAD:refs/heads/gh-pages
working-directory: ./pages