forked from OpenBAS-Platform/openbas
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from troll-os/openex-featurebranch-actions
Openex featurebranch actions
- Loading branch information
Showing
2 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: test-feature-branch | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
openex_config: | ||
type: string | ||
default: '{}' | ||
required: false | ||
|
||
jobs: | ||
platform: | ||
name: platform | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: jirutka/setup-alpine@v1 | ||
with: | ||
branch: v3.18 | ||
packages: > | ||
nodejs npm git tini gcc g++ make musl-dev cargo default-jre maven postfix postfix-pcre | ||
- name: Setup Node.js | ||
run: | | ||
npm install -g yarn | ||
shell: alpine.sh --root {0} | ||
|
||
- name: Build into Alpine | ||
run: | | ||
cd openex-platform/openex-front | ||
yarn install | ||
yarn build | ||
cd ../ | ||
mvn install -DskipTests -Pdev | ||
shell: alpine.sh {0} | ||
|
||
- run: mkdir -p openex-build/ | ||
- run: cp ./openex-platform/openex/openex-api/target/openex-api.jar openex-build/ | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: filigran/platform | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- name: Login to DockerHub | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: openex-platform/Dockerfile_ga | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
deploy: | ||
name: deploy | ||
needs: [platform] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: filigran/platform | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- name: deploy via awx | ||
uses: certara/github-action-ansible-tower-awx@master | ||
with: | ||
ansible-tower-user: ${{ secrets.AWX_USER }} | ||
ansible-tower-pass: ${{ secrets.AWX_PASSWORD }} | ||
ansible-tower-url: ${{ secrets.AWX_URL }} | ||
template-id: "34" | ||
additional-vars: | | ||
{ "openex_version": "${{steps.meta.outputs.version}}", "openex_config": ${{ inputs.openex_config }} } | ||
- name: display URL | ||
run: echo "https://${{steps.meta.outputs.version}}.oex.dev.filigran.io" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM openjdk:19-jdk-alpine AS app | ||
|
||
WORKDIR /opt | ||
RUN apk add tini git | ||
COPY openex-build ./ | ||
|
||
ENTRYPOINT ["/usr/bin/tini", "--"] | ||
CMD ["java", "-jar", "openex-api.jar"] |