Skip to content

Commit

Permalink
Move to GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Nowak committed Jun 14, 2023
0 parents commit c4a40bf
Show file tree
Hide file tree
Showing 134 changed files with 9,527 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Builds the project
on:
workflow_call:
inputs:
java-version:
description: "JDK Version"
type: string
required: true
version:
description: "Version to build"
type: string
required: true
pushDockerImage:
description: "Push docker image"
default: false
type: boolean
secrets:
REGISTRY_USERNAME:
required: true
REGISTRY_PASSWORD:
required: true
env:
DOCKER_REGISTRY: docker.io
DOCKER_IMAGE_NAME: appstore-bundle-service

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
ref: v${{ inputs.version }}
- name: Setup JDK
uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
cache: maven
- name: Build
run:
mvn package -DskipTests -DskipJarUpload=true -DscmCommit=${{ github.sha }} -DscmBranch=${{ github.ref_name }} -Ddocker_registry.username=${{ secrets.REGISTRY_USERNAME }} -Ddocker_registry.domain=${{ env.DOCKER_REGISTRY }} -Ddocker.image=${{ env.DOCKER_IMAGE_NAME }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Push
run:
docker push --all-tags ${{ env.DOCKER_REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/${{ env.DOCKER_IMAGE_NAME }}
45 changes: 45 additions & 0 deletions .github/workflows/helm-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release helm package
on:
workflow_call:
inputs:
version:
description: "Helm package version"
default: true
type: string
secrets:
token:
required: true
env:
CI_COMMIT_AUTHOR: Dac-Cloud-Bot
CI_COMMIT_AUTHOR_EMAIL: [email protected]
CI_COMMIT_MESSAGE: "[CI] Add Helm Chart"
HELM_REPOSITORY: https://libertyglobal.github.io/appstore-bundle-service/charts
jobs:
release-helm:
permissions:
contents: write
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name ${{ env.CI_COMMIT_AUTHOR }}
git config user.email ${{ env.CI_COMMIT_AUTHOR_EMAIL }}
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.5.0
- name: Generate and Publish Helm
run: |
git pull
helm package --version ${{ inputs.version }} --app-version ${{ inputs.version }} helm/appstore-bundle-service -d charts/
helm repo index charts/ --url ${{ env.HELM_REPOSITORY }}
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "{{ env.CI_COMMIT_AUTHOR_EMAIL }}"
git add charts/
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
git push
60 changes: 60 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release a new version
on:
workflow_dispatch:
inputs:
nextRelease:
description: "Version to release"
type: string
required: true
nextDevelopmentVersion:
description: "Next development version"
type: string
required: true
runTests:
description: "Run IT tests"
default: true
type: boolean

jobs:
test:
if: inputs.runTests
uses: ./.github/workflows/test.yaml
with:
java-version: '17'
set-release-version:
permissions: write-all
uses: ./.github/workflows/set-version.yaml
if: always() &&
!contains(needs.test.result, 'failure') &&
!contains(needs.test.result, 'cancelled')
with:
java-version: '17'
version: ${{ inputs.nextRelease }}
commit_message: "Release ${{ inputs.nextRelease }}"
commit: true
create_tag: true
build:
uses: ./.github/workflows/build.yaml
needs: set-release-version
with:
pushDockerImage: true
version: ${{ inputs.nextRelease }}
java-version: '17'
secrets: inherit
helm-release:
permissions: write-all
uses: ./.github/workflows/helm-release.yaml
needs: build
with:
version: ${{ inputs.nextRelease }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
set-dev-version:
permissions: write-all
uses: ./.github/workflows/set-version.yaml
needs: helm-release
with:
version: ${{ inputs.nextDevelopmentVersion }}
commit_message: "Prepare for next development iteration ${{ inputs.nextDevelopmentVersion }}"
commit: true
java-version: '17'
82 changes: 82 additions & 0 deletions .github/workflows/set-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Sets version on project
on:
workflow_call:
inputs:
java-version:
description: "JDK Version"
type: string
required: true
version:
description: "Version to set"
type: string
required: true
commit:
description: "Commit"
type: boolean
default: false
commit_message:
description: "Commit message"
type: string
create_tag:
description: "Create tag"
type: boolean
default: false
env:
CI_COMMIT_AUTHOR: Dac-Cloud-Bot
CI_COMMIT_AUTHOR_EMAIL: [email protected]
CI_COMMIT_MESSAGE: "[CI] ${{ inputs.commit_message }}"

jobs:
set-version:
if: inputs.commit == false
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
cache: maven
- name: Set next release version
run: mvn versions:set -DnewVersion=${{ inputs.version }} -DprocessAllModules
set-version-tag-and-commit:
if: inputs.commit && inputs.create_tag
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
cache: maven
- name: GIT commit and push all changed files
run: |
git pull
mvn versions:set -DnewVersion=${{ inputs.version }} -DprocessAllModules
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_AUTHOR_EMAIL }}"
git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
git tag -a v${{ inputs.version }} -m "Version ${{ inputs.version }}"
git push --tags
set-version-and-commit:
if: inputs.commit && inputs.create_tag == false
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
cache: maven
- name: GIT commit and push all changed files
run: |
git pull
mvn versions:set -DnewVersion=${{ inputs.version }} -DprocessAllModules
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_AUTHOR_EMAIL }}"
git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
git push
42 changes: 42 additions & 0 deletions .github/workflows/static.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
42 changes: 42 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test the project
on:
workflow_call:
inputs:
java-version:
description: "JDK Version"
type: string
required: true
jobs:
test:
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:12
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
testcontainers:
image: testcontainers/ryuk:0.3.0
ports:
- 46577:46577
volumes:
- /var/run/docker.sock:/var/run/docker.sock

steps:
- uses: actions/checkout@v3
- name: Setup JDK
uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
cache: maven
- name: Test
run:
mvn verify -DskipJarUpload=true -Ddb.port=5432 -Ddocker.skip=true
mvn verify -Dci-stage=integration-tests -DskipJarUpload=true -Ddb.port=5432 -Ddocker.skip=true
Loading

0 comments on commit c4a40bf

Please sign in to comment.