name: Create a new release on: release: types: [created] workflow_dispatch: inputs: tag: description: "Tag for the Docker image" required: true default: "test" jobs: build-and-push: runs-on: ubuntu-latest steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout repository uses: actions/checkout@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Log in to Docker Hub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} # Build the Docker image with the latest tag and the release tag - name: Build and push Docker image with latest tag uses: docker/build-push-action@v2 if: github.event.inputs.tag != 'test' with: context: . push: true tags: uugai/kerberos-documentation:latest - name: Build and push Docker image with release tag uses: docker/build-push-action@v2 if: github.event.inputs.tag != 'test' with: context: . push: true tags: uugai/kerberos-documentation:${{ github.event.inputs.tag || github.ref_name }} # After we build the Docker image, we create a pull request to update the GitOps repository # This will allow us to update the Helm chart with the new Docker image tag. - name: Create GitOps Pull Request uses: cedricve/gitops-pullrequest-action@master with: github-token: ${{ secrets.TOKEN }} gitops-repo: "uug-ai/gitops" gitops-file: "environments/staging/doc.kerberos.io/deployment.yaml" gitops-pr-branch: "release-kerberos-documentation-${{ github.event.inputs.tag || github.ref_name }}" gitops-key: ".spec.template.spec.containers[0].image" gitops-value: "uugai/kerberos-documentation:${{ github.event.inputs.tag || github.ref_name }}" commit-email: "gitops@uug.ai" commit-name: "GitOps - UUG.AI" commit-message: "A new release for Kerberos documentation - ${{ github.event.inputs.tag || github.ref_name }}"