diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..3ce122d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,52 @@ +name: Deploy Python Application + +on: + pull_request: + types: + - closed + branches: + - main + +jobs: + get-version: + name: Determine Next Version + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true + outputs: + version: ${{ steps.version.outputs.next_version }} + steps: + - uses: actions/checkout@v4 + + - name: Determine next version + id: version + uses: Aignosi/github_workflow_templates/.github/actions/determine-next-version@main + with: + branch_name: ${{ github.event.pull_request.head.ref }} + + deploy: + name: Deploy + needs: [get-version] + uses: Aignosi/github_workflow_templates/.github/workflows/reusable-deploy.yml@feature/SIENTIAPDE-1352 + with: + version: ${{ needs.get-version.outputs.version }} + project_type: 'python' + image_name: 'sientia-dataops-model-manager' + helm_chart_path: 'sientia-module' + helm_release_name: 'sientia-dataops-model-manager' + helm_namespace: 'sientia' + app_owner: 'Aignosi' + private_repos: 'sientia-dataops-library' + helm_repo_name: 'sientia' + helm_repo_url: 'https://raw.githubusercontent.com/Aignosi/sientia-dataops-helm-repo/refs/heads/main/' + helm_chart_version: '0.6.0' + helm_values_file: './values.yaml' + secrets: + AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} + REGISTRY_LOGIN_SERVER: ${{ secrets.REGISTRY_LOGIN_SERVER }} + REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} + SUSE_RKE2_KUBE_CONFIG: ${{ secrets.SUSE_RKE2_KUBE_CONFIG }} + CI_DEPS_APP_ID: ${{ secrets.CI_DEPS_APP_ID }} + CI_DEPS_PRIVATE_KEY: ${{ secrets.CI_DEPS_PRIVATE_KEY }} + HELM_REPO_USERNAME: ${{ secrets.HELM_REPO_USERNAME }} + HELM_REPO_PASSWORD: ${{ secrets.HELM_REPO_PASSWORD }} diff --git a/README.md b/README.md index 974ca62..977bfda 100644 --- a/README.md +++ b/README.md @@ -1232,8 +1232,8 @@ Create a `.secrets` file in the project root to store tokens and credentials: GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx SONAR_TOKEN=sqp_xxxxxxxxxxxxxxxxxxxx SONAR_HOST_URL=https://sonarqube.example.com -APP_ID=123456 -APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----" +CI_DEPS_APP_ID=123456 +CI_DEPS_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----" ``` > ⚠️ **Important**: The `.secrets` file is already in `.gitignore`. Never commit this file! @@ -1274,6 +1274,32 @@ act pull_request -j quality-gate \ --eventpath .event.json ``` +#### Run Deploy Workflow with Local Repository + +If you have workflows that reference external repositories (e.g., reusable workflows), you can map them locally: + +```bash +act pull_request \ + -e .event.json \ + --secret-file .secrets \ + -W .github/workflows/deploy.yml \ + --local-repository Aignosi/github_workflow_templates=/path/to/local/github_workflow_templates \ + --container-daemon-socket /var/run/docker.sock \ + --container-options "--user $(id -u):$(id -g)" +``` + +#### Docker Socket Permissions + +If you encounter permission issues with Docker socket: + +```bash +# Grant temporary access to Docker socket +sudo chmod 666 /var/run/docker.sock + +# Fix file ownership after running act (if needed) +sudo chown -R $USER:$USER /path/to/project +``` + ### Command Reference #### Command Parameters