diff --git a/.github/workflows/azure.yml b/.github/workflows/azure.yml new file mode 100644 index 00000000..961362f5 --- /dev/null +++ b/.github/workflows/azure.yml @@ -0,0 +1,56 @@ +name: Azure cloud + +on: + push: + branches: + [ master ] + paths: + - '**' + - '.github/workflows/azure.yml' + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: 11 + distribution: temurin + cache: maven + - name: Build container image + run: | + mvn -U -B package --file pom.xml -DskipTests \ + -Dquarkus.native.container-build=true \ + -Dquarkus.container-image.push=false \ + -Dquarkus.container-image.build=true \ + -Dquarkus.container-image.registry=ghcr.io \ + -Dquarkus.container-image.group=project-openubl \ + -Dquarkus.container-image.name=searchpe/searchpe \ + -Dquarkus.container-image.tag=${{ github.sha }} \ + -P native,ui + - uses: docker/login-action@v1 + with: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Push images to registry + run: | + docker push ghcr.io/project-openubl/searchpe/searchpe:${{ github.sha }} + + deploy: + runs-on: ubuntu-latest + needs: build + steps: + - name: Azure Login + uses: azure/login@v1 + with: + creds: ${{ secrets.SEARCHPE_AZURE_CREDENTIALS }} + - name: Deploy to containerapp + uses: azure/CLI@v1 + with: + inlineScript: | + az config set extension.use_dynamic_install=yes_without_prompt + az containerapp registry set -n searchpe -g openubl --server ghcr.io + az containerapp update -n searchpe -g openubl --image ghcr.io/project-openubl/searchpe/searchpe:${{ github.sha }} diff --git a/.github/workflows/searchpe-AutoDeployTrigger-4fbd39be-c020-47a4-9750-297269d975bc.yml b/.github/workflows/searchpe-AutoDeployTrigger-4fbd39be-c020-47a4-9750-297269d975bc.yml deleted file mode 100644 index ebdd547a..00000000 --- a/.github/workflows/searchpe-AutoDeployTrigger-4fbd39be-c020-47a4-9750-297269d975bc.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Trigger auto deployment for searchpe - -# When this action will be executed -on: - # Automatically trigger it when detected changes in repo - push: - branches: - [ master ] - paths: - - '**' - - '.github/workflows/searchpe-AutoDeployTrigger-4fbd39be-c020-47a4-9750-297269d975bc.yml' - - # Allow mannually trigger - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout to the branch - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Log in to container registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ secrets.SEARCHPE_REGISTRY_USERNAME }} - password: ${{ secrets.SEARCHPE_REGISTRY_PASSWORD }} - - - name: Build and push container image to registry - uses: docker/build-push-action@v2 - with: - push: true - tags: ghcr.io/searchpe:${{ github.sha }} - file: ./Dockerfile - context: ./ - - - deploy: - runs-on: ubuntu-latest - needs: build - - steps: - - name: Azure Login - uses: azure/login@v1 - with: - creds: ${{ secrets.SEARCHPE_AZURE_CREDENTIALS }} - - - - name: Deploy to containerapp - uses: azure/CLI@v1 - with: - inlineScript: | - az config set extension.use_dynamic_install=yes_without_prompt - az containerapp registry set -n searchpe -g openubl --server ghcr.io --username ${{ secrets.SEARCHPE_REGISTRY_USERNAME }} --password ${{ secrets.SEARCHPE_REGISTRY_PASSWORD }} - az containerapp update -n searchpe -g openubl --image ghcr.io/searchpe:${{ github.sha }}