Build and deploy from branch. #26
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, push and update | |
on: | |
workflow_dispatch: | |
inputs: | |
skip-unit-test: | |
type: boolean | |
required: true | |
description: Skip unit-test | |
jobs: | |
build_push_update: | |
runs-on: ubuntu-latest | |
environment: dev-cd | |
permissions: | |
id-token: write | |
packages: write | |
contents: write | |
steps: | |
# | |
# Checkout the source code. | |
# | |
- name: Checkout the source code | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | |
with: | |
token: ${{ secrets.GIT_PAT }} | |
fetch-depth: 0 | |
# | |
# Cache JDK. | |
# | |
- name: Cache JDK | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 | |
id: cache-jdk | |
with: | |
key: OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz | |
path: | | |
${{ runner.temp }}/jdk_setup.tar.gz | |
${{ runner.temp }}/jdk_setup.sha256 | |
# | |
# RELEASE CANDIDATE - Build Docker image. | |
# | |
- name: RELEASE CANDIDATE - Build jar and Docker image | |
run: | | |
docker build \ | |
--secret id=my_user,src=${{ secrets.GIT_USER }} \ | |
-f src/main/docker/Dockerfile.multistage \ | |
-t ghcr.io/${{ github.repository }}:${{ github.head_ref || github.ref_name }} \ | |
. | |
# | |
# RELEASE CANDIDATE - Push Docker image. | |
# | |
- name: RELEASE CANDIDATE - Push Docker image | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
docker push -a ghcr.io/${{ github.repository }} | |
# | |
# Install Node. | |
# | |
- name: Install Node | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c | |
with: | |
node-version: "18.16.0" | |
# | |
# Install Newman. | |
# | |
- name: Install Newman | |
run: npm install -g newman | |
# | |
# Run Postman collection. | |
# | |
- name: Run Postman collection | |
run: | | |
newman run src/test/postman/mil-papos.postman_collection.json \ | |
-e src/test/postman/dev.postman_environment.json \ | |
--env-var "clientIdPsp=${{ secrets.NEWMAN_IT__PSP_TOKEN_CLIENT_ID }}" \ | |
--env-var "clientSecretPsp=${{ secrets.NEWMAN_IT_PSP_TOKEN_CLIENT_SECRET }}" \ | |
--env-var "clientIdPa=${{ secrets.NEWMAN_IT__PA_TOKEN_CLIENT_ID }}" \ | |
--env-var "clientSecretPa=${{ secrets.NEWMAN_IT_PA_TOKEN_CLIENT_SECRET }}" \ | |
--env-var "clientIdAdm=${{ secrets.NEWMAN_IT__PAPOS_ADMIN_TOKEN_CLIENT_ID }}" \ | |
--env-var "clientSecretAdm=${{ secrets.NEWMAN_IT_PAPOS_ADMIN_TOKEN_CLIENT_SECRET }}" |