Skip to content

publish

publish #568

Workflow file for this run

name: publish
on:
repository_dispatch:
types: [publish]
workflow_dispatch:
push:
tags:
- "v*.*.*"
env:
GITHUB_TOKEN: ${{ secrets.WRITE_PACKAGES }}
jobs:
publish-snapi-components:
runs-on: [self-hosted,snapi]
container:
image: ghcr.io/raw-labs/raw-scala-runner:21.0.0-ol9-20230919_scala2.12.18_sbt1.9.6
options: --user 1001 --cpus 6 --memory 32g -e HOME=/home/sbtuser
credentials:
username: ${{ github.actor }}
password: ${{ secrets.READ_PACKAGES }}
env:
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
JVM_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
steps:
- if: github.event_name != 'repository_dispatch'
name: checkout caller ref
uses: actions/checkout@v4
with:
fetch-depth: 0
- if: github.event_name == 'repository_dispatch'
name: checkout for PR comment
uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.pull_request.head.sha }}
fetch-depth: 0
- name: sbt ci-release
run: |
export HOME="/home/sbtuser"
export SDKMAN_DIR="$HOME/.sdkman"
source $SDKMAN_DIR/bin/sdkman-init.sh
yes n | sdk install java 21.0.1-graalce || true
sdk use java 21.0.1-graalce
echo "$SDKMAN_DIR/candidates/java/current/bin" >> $GITHUB_PATH
sbt update
sbt clean publish
- name: evaluate produced version
shell: bash
run: echo "VERSION=$(cat ./version)" >> $GITHUB_ENV
- if: github.event_name == 'repository_dispatch'
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.RAW_CI_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
body: |
> published version: ${{ env.VERSION }}
reactions: rocket
- if: success() && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.RAW_CI_PAT }}
event-type: release
client-payload: '{"ref": "${{ github.ref }}", "tag": "${{ github.ref_name }}"}'
- if: failure() && github.event_name == 'repository_dispatch'
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.RAW_CI_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
body: |
> something went wrong with `publish-snapi-components`
> run [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) failed :x:
reactions: confused