repackaging #1218
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 VAuthenticator | |
on: | |
push: { } | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'make a tag' | |
required: false | |
type: string | |
newversion: | |
description: 'Next desired version' | |
required: false | |
type: string | |
jobs: | |
tag-artifact: | |
if: github.event.inputs.version != '' || github.event.inputs.version != ' ' | |
needs: | |
- build-backend | |
- ui-backend | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: make an echo | |
run: | | |
echo version ${{github.event.inputs.version}} | |
- name: set the Tag version | |
run: | | |
git config --global user.email "${{ secrets.GIT_EMAIL }}" | |
git config --global user.name "${{ secrets.GIT_USERNAME }}" | |
mvn versions:set -DnewVersion=${{github.event.inputs.version}} | |
git commit -am "[skip-ci] new version release ${{github.event.inputs.version}}" | |
git push | |
- name: Create tag | |
uses: ncipollo/release-action@v1 | |
with: | |
bodyFile: changelog/${{github.event.inputs.version}}.md | |
tag: ${{github.event.inputs.version}} | |
- name: set the Next Development version | |
run: | | |
git config --global user.email "${{ secrets.GIT_EMAIL }}" | |
git config --global user.name "${{ secrets.GIT_USERNAME }}" | |
mvn versions:set -DnewVersion=${{github.event.inputs.newversion}} | |
git commit -am "[skip-ci] new version release ${{github.event.inputs.newversion}}" | |
git push | |
build-backend: | |
runs-on: ubuntu-20.04 | |
services: | |
postgres: | |
image: postgres:14-alpine | |
ports: | |
- "5432:5432" | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
localstack: | |
image: localstack/localstack:3.2 | |
ports: | |
- "4566-4599:4566-4599" | |
env: | |
SERVICES: s3,kms,dynamodb,sns | |
redis: | |
image: redis | |
ports: | |
- "6379:6379" | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 21 | |
distribution: 'corretto' | |
- name: Build | |
run: | | |
mvn install -q | |
- name: docker push | |
run: | | |
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }} | |
if [[ ${GITHUB_REF##*/} == 'master' ]] | |
then | |
DOCKER_TAG="latest" | |
else | |
DOCKER_TAG="${GITHUB_REF##*/}" | |
fi | |
echo "$DOCKER_TAG" | |
docker build -t mrflick72/vauthenticator-k8s:$DOCKER_TAG -f application.Dockerfile . | |
docker push mrflick72/vauthenticator-k8s:$DOCKER_TAG | |
- name: Docker tag | |
if: github.event.inputs.version != '' || github.event.inputs.version != ' ' | |
run: | | |
DOCKER_TAG="${{github.event.inputs.version}}" | |
docker build -t mrflick72/vauthenticator-k8s:$DOCKER_TAG -f application.Dockerfile . | |
docker push mrflick72/vauthenticator-k8s:$DOCKER_TAG | |
ui-backend: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 21 | |
- name: Build frontend artifacts | |
run: | | |
cd src/main/frontend | |
npm install --legacy-peer-deps | |
npm run-script production-build | |
- name: load static file on s3 | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- run: | | |
UI_VERSION=${{github.event.inputs.version}} | |
cd src/main/frontend/dist/asset | |
ls *.js | while read line | |
do | |
aws s3 cp $line s3://${{ secrets.VAUTHENTICATOR_BUCKET }}/static-asset/content/asset/${GITHUB_REF##*/}/$line | |
aws s3 cp $line s3://${{ secrets.VAUTHENTICATOR_BUCKET }}/static-asset/content/asset/$line | |
if [ ${UI_VERSION} ]; then | |
aws s3 cp $line s3://${{ secrets.VAUTHENTICATOR_BUCKET }}/static-asset/content/asset/${UI_VERSION}/$line | |
fi | |
done |