debug #11
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: CI Branch | |
on: | |
push: | |
branches: | |
- '!1.0.x' | |
- '**' | |
# paths: ['src/**'] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build_test: | |
name: Build and Test | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
scala: [2.13.10] | |
java: [temurin@11] | |
environment: dev | |
runs-on: ${{ matrix.os }} | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout current branch (full) | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Java (temurin@11) | |
if: matrix.java == 'temurin@11' | |
uses: actions/setup-java@v2 | |
with: | |
distribution: temurin | |
java-version: 11 | |
- name: Cache sbt | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.sbt | |
~/.ivy2/cache | |
~/.coursier/cache/v1 | |
~/.cache/coursier/v1 | |
~/AppData/Local/Coursier/Cache/v1 | |
~/Library/Caches/Coursier/v1 | |
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} | |
- name: Install node 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Installing openapi-generator-cli | |
run: npm install -g @openapitools/openapi-generator-cli | |
- name: Build project | |
run: sbt ++${{ matrix.scala }} test | |
- name: Publish project | |
run: sbt ++${{ matrix.scala }} publish | |
- name: Generate target | |
run: sbt ++${{ matrix.scala }} docker:stage | |
- name: Normalize repo name | |
run: | | |
# github.reposiory is in the format "owner/repository-name", we need only the repo name | |
NORM_REPO="$(echo "${{ github.repository }}" | cut -d"/" -f2)" | |
echo "NORM_REPO=$NORM_REPO" >> "$GITHUB_ENV" | |
ls -l | |
tree -L 3 ./target | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: ${{ vars.AWS_REGION }} | |
role-to-assume: ${{ vars.IAM_ROLE_ARN }} | |
role-session-name: ${{ env.NORM_REPO }}-${{ github.run_number }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build and push on GitHub packages | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./target/docker/stage | |
file: Dockerfile | |
push: true | |
tags: | | |
${{ env.NORM_REPO }}:${{ github.ref_name }} | |
${{ env.NORM_REPO }}:commit-${{ github.sha }} | |
# - name: Build, tag, and push image to Amazon ECR | |
# env: | |
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
# COMMIT_SHA: ${{ github.sha }} | |
# run: 'sbt ++${{ matrix.scala }} docker:publish' |