Skip to content

pipeline docker credentials #830

pipeline docker credentials

pipeline docker credentials #830

Workflow file for this run

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
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'corretto'
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: build testing environment
run: |
export AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}
export AWS_REGION=${{ secrets.AWS_REGION }}
cd src/test/resources
docker-compose up &
sleep 80s
sudo chown -R $USER:$USER *
chmod 777 -R docker/dynamodb
aws s3api create-bucket --bucket bucket --endpoint http://localhost:4566 --region us-east-1
aws s3 cp index.html s3://bucket/mail/templates/welcome.html --endpoint http://localhost:4566 --region us-east-1
- 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
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
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@v3
with:
node-version: 16
- 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: |
cd src/main/frontend/dist/asset
ls *.js | while read line
do
aws s3 cp $line s3://${{ secrets.VAUTHENTICATOR_BUCKET }}/static-asset/content/asset/$line
done