Skip to content

build: remove spaces in parameter overrides #33

build: remove spaces in parameter overrides

build: remove spaces in parameter overrides #33

name: CI
on:
push:
paths-ignore:
- 'docs/**'
- 'tampermonkey/**'
- 'README.md'
- 'docker-compose.yml'
env:
JAVA_VERSION: '21'
AWS_REGION: 'eu-central-1'
AZURE_LOCATION: 'germanywestcentral'
AZURE_FUNCTIONAPP_NAME: 'timesheetwizardapp'
AZURE_RESOURCE_GROUP: 'timesheetwizard'
AZURE_RESOURCES_FILE: './tw-app-azure/deployment/main.bicep'
AZURE_PACKAGE_DIRECTORY: './tw-app-azure/build/azure-functions'
TIMESHEET_WIZARD_IMPORT_CLOCKIFY_API_KEY: ${{ secrets.TW_IMPORT_CLOCKIFY_API_KEY}}
TIMESHEET_WIZARD_IMPORT_CLOCKIFY_WORKSPACE_ID: ${{ secrets.TW_IMPORT_CLOCKIFY_WORKSPACE_ID}}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- name: Build & test with Gradle
run: ./gradlew test
- name: Generate test report (tw-core)
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: generate test report (tw-core)
path: ./tw-core/build/test-results/test/*.xml
reporter: java-junit
- name: Generate test report (tw-app-aws)
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: generate test report (tw-app-aws)
path: ./tw-app-aws/build/test-results/test/*.xml
reporter: java-junit
- name: Generate test report (tw-app-azure)
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: generate test report (tw-app-azure)
path: ./tw-app-azure/build/test-results/test/*.xml
reporter: java-junit
deploy-to-azure:
if: github.ref_name == 'master'
runs-on: ubuntu-24.04
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- name: Install Azure Core Tools
run: |
wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install azure-functions-core-tools-4
- name: Login to Azure
uses: Azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDS }}
- name: Deploy Azure resources
uses: azure/bicep-deploy@v1
with:
type: deployment
operation: create
name: ${{ env.AZURE_RESOURCE_GROUP }}
scope: subscription
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID}}
location: ${{ env.AZURE_LOCATION }}
template-file: ${{ env.AZURE_RESOURCES_FILE }}
parameters: '{"location":"${{ env.AZURE_LOCATION }}", "name":"${{ env.AZURE_RESOURCE_GROUP }}", "functionAppName":"${{ env.AZURE_FUNCTIONAPP_NAME }}"}'
- name: Build, package, deploy Azure Function with Gradle
run: ./gradlew tw-app-azure:build -x test :tw-app-azure:azureFunctionsDeploy
deploy-to-aws:
if: github.ref_name == 'master'
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Print SAM version
run: sam --version
- name: Build AWS stack with SAM
run: sam build --template-file tw-app-aws/deployment/template.yml
- name: Deploy AWS stack with SAM
run: sam deploy --config-file tw-app-aws/deployment/samconfig.toml --parameter-overrides MonitoringRecipient=${{ secrets.MONITORING_RECIPIENT }} ClockifyApiKey=${{ env.TIMESHEET_WIZARD_IMPORT_CLOCKIFY_API_KEY }} ClockifyWorkspaceId=${{ env.TIMESHEET_WIZARD_IMPORT_CLOCKIFY_WORKSPACE_ID }}
- name: Invoke ImportFunction with SAM
run: >
sam remote invoke --stack-name tw TwFunction -e '{"customerIds": ["1000"], "dateRangeType": "CUSTOM_YEAR", "dateRange": "2022"}'
release:
if: github.ref_name == 'master'
runs-on: ubuntu-latest
needs:
- deploy-to-aws
- deploy-to-azure
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- name: Retrieve current version number
run: ./gradlew printVersion
- name: Update release version
run: |
./gradlew releaseVersion
- name: Push release tag
run: |
git push --all
git push --tags
- name: Retrieve updated version number
run: ./gradlew printVersion
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag=$(git describe --tags --abbrev=0)
version=$(./gradlew -q printVersion)
./gradlew -q printChangeLog | gh release create $tag -t "$version" -F -