chore(deps): update dependency scala to v3.3.3 #311
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
name: Run cached tests | |
# Build script adopted from itemstack-count-infrastructure | |
# https://github.com/kory33/itemstack-count-infrastructure/blob/22721250c3e8bb2688538e3933a5f5f998406c2c/.github/workflows/create-release.yml | |
on: | |
push: | |
branches: | |
- '*' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
lint_and_test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Prepare build dependencies cache | |
uses: ./.github/actions/cache-build-dependencies | |
with: | |
cache-version: v-4 | |
- name: Prepare build cache | |
uses: ./.github/actions/cache-builds | |
with: | |
cache-version: v-3 | |
- name: Lint and Test | |
run: sbt "scalafmtCheckAll; compile; scalafixAll --check; test" | |
publish: | |
runs-on: ubuntu-22.04 | |
# we wish to publish on tags (non-SNAPSHOT versions) | |
# and on master branch (SNAPSHOT versions) as long as lint_and_test passed | |
needs: lint_and_test | |
if: ${{ startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/master') }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Prepare build dependencies cache | |
uses: ./.github/actions/cache-build-dependencies | |
with: | |
cache-version: v-3 | |
- name: Prepare build cache | |
uses: ./.github/actions/cache-builds | |
with: | |
cache-version: v-2 | |
- name: Import signing PGP key | |
env: | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
run: | | |
gpg --version | |
echo "$PGP_SECRET" | gpg --import | |
- name: Publish SNAPSHOT artifacts to Sonatype | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
run: sbt publishSigned | |
- name: Publish non-SNAPSHOT version to Maven central | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
run: | | |
DECLARED_VERSION="$(grep -oP "(?<=ThisBuild / version := \")((\d+\.)+\d+)(?=-SNAPSHOT\")" build.sbt)" | |
TAGGED_VERSION=$(echo ${{ github.ref }} | sed -e "s~^refs/tags/v~~") | |
if [ "$DECLARED_VERSION" != "$TAGGED_VERSION" ]; then | |
echo "Found $DECLARED_VERSION on build.sbt, but tagged $TAGGED_VERSION. Exiting..." | |
exit 1 | |
fi | |
# set the artifact version to DECLARED_VERSION | |
sed -i -e "s~ThisBuild / version := \".*\"~ThisBuild / version := \"$DECLARED_VERSION\"~" build.sbt | |
# publish to local repository, and then release bundle | |
sbt "publishSigned; sonatypeBundleRelease" | |
create-github-release: | |
runs-on: ubuntu-latest | |
# when we published a non-SNAPSHOT version | |
needs: publish | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get the version | |
id: get_version | |
run: echo "::set-output name=VERSION::${GITHUB_REF#refs/tags/}" | |
- name: Get commit summary | |
id: get_commit_summary | |
run: | | |
PREVIOUS_TAG="$(git tag --sort=-creatordate | sed -n 2p)" | |
echo "PREVIOUS_TAG: $PREVIOUS_TAG" | |
COMMIT_SUMMARY="$(git log --oneline --pretty=tformat:"%h %s" "$PREVIOUS_TAG..${{ github.ref }}")" | |
COMMIT_SUMMARY="${COMMIT_SUMMARY//$'\n'/'%0A'}" | |
echo "::set-output name=COMMIT_SUMMARY::$COMMIT_SUMMARY" | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.get_version.outputs.VERSION }} | |
name: Release ${{ steps.get_version.outputs.VERSION }} | |
body: | | |
${{ steps.get_commit_summary.outputs.COMMIT_SUMMARY }} | |
draft: false | |
prerelease: false |