ci: add new release process for DEV (#338) #1
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: Build and Publish Revision | |
concurrency: | |
group: release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "main" | |
paths: | |
- "mediator/**" | |
- "*.sbt" | |
- "project/**" | |
- "webapp/**" | |
jobs: | |
build: | |
if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }} | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_ACTOR: "hyperledger-bot" | |
GITHUB_ACTOR_EMAIL: "hyperledger-bot@hyperledger.org" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true | |
SBT_OPTS: -Xmx2G | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Java and Scala | |
uses: olafurpg/setup-scala@v14 | |
with: | |
java-version: openjdk@1.11 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ env.GITHUB_ACTOR }} | |
password: ${{ env.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Get short commit hash | |
run: echo "COMMIT_HASH=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
- name: Set build number | |
run: echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV | |
- name: Extract version from version.sbt | |
id: get_version | |
run: | | |
VERSION=$(grep -Eo 'version := "[^"]+"' version.sbt | sed 's/version := "//; s/"//; s/-SNAPSHOT//') | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Set build version | |
run: echo "BUILD_VERSION=${{ env.VERSION }}-${{ env.BUILD_NUMBER }}-${{ env.COMMIT_HASH }}" >> $GITHUB_ENV | |
- name: Build and push Docker image | |
run: | | |
sbt "set ThisBuild / version := \"${{ env.BUILD_VERSION }}\"" "docker:stage" | |
docker buildx build --platform=linux/arm64,linux/amd64 --push -t ghcr.io/hyperledger/identus-mediator:${{ env.BUILD_VERSION}} ./mediator/target/docker/stage | |
- name: Trigger helm chart update | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.ATALA_GITHUB_TOKEN }} | |
repository: input-output-hk/atala-prism-helm-charts | |
event-type: build-chart-package | |
client-payload: '{"version": "${{ env.BUILD_VERSION }}", "chart": "mediator"}' |